13:59 Mon Sep  3, 2007
Cheap Hummer!

12:18 Tue Jul  4, 2006
Hummer Camp After

12:15 Tue Jul  4, 2006
Hummer Camp

Help Me Humpa
PHP and MMS Server Help
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Create file

 
Post new topic   Reply to topic    Help Me Humpa Forum Index -> Anything PHP
View previous topic :: View next topic  
Author Message
bobhinkle



Joined: 13 Oct 2006
Posts: 68

PostPosted: Fri Oct 13, 2006 1:35 pm    Post subject: Create file Reply with quote

Hey humpa. Sorry to bug on simple stuff but i am trying to write a php file to mange hottproxy users. the problem i have is when i do

$ourFileName = "./hottprxy/testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);

it doesn't create the file. I think its a permissions problem but i dont know if its a chmod problem or a chown problem. Can you please help.
Back to top
View user's profile Send private message
Humpa
Site Admin


Joined: 06 Nov 2005
Posts: 10258

PostPosted: Fri Oct 13, 2006 1:48 pm    Post subject: Reply with quote

Try using the full path - and try chmodding the hottproxy directory to 777 - see if that does anything
Back to top
View user's profile Send private message
bobhinkle



Joined: 13 Oct 2006
Posts: 68

PostPosted: Tue Oct 24, 2006 5:14 pm    Post subject: ok Reply with quote

I will work with this. i have another question. I am converting a perl script used to parse a log file from hottproxy. i tried using:

<?php

$perl = new perl();
$per->eval(' perl expression');

?>

but it doesn't work. Here is the main part of the code i can convert
Perl Version:

while (<$filehandle>) {
chomp $_;
if ($_) {
my @record = split(/\t/,$_);

my php version so far

while(!feof($ourFileHandle)){
$chomped = rtrim($outFileHandle, "\n.");
$record = split("\t",$chomped);

problem is while loop is forever and $record doesn't have any info in it.

last part. the file is just a tab delimited file

Ex.
2006-10-09 22:51:21 SYSTEM 127.0.0.1 HoTTProxy Ver. 0.24.0.0 Started up...
Back to top
View user's profile Send private message
Humpa
Site Admin


Joined: 06 Nov 2005
Posts: 10258

PostPosted: Thu Oct 26, 2006 11:37 am    Post subject: Reply with quote

See what this does:
Code:
<?php
$i = 1;
$delimeter = "\t"; // this is for a delimeter that is a tab, I think
$filehandle = fopen("path/to/file.txt", "r");
while (($data_array = fgetcsv($filehandle, 1000, "$delimeter")) !== FALSE) {
   echo "line $i:<br><br>\n";
   while (list($key, $value) = each($data_array)) {
      echo "key is $key and value is $value<br>\n";
   }
   echo "<hr>";
   $i++;
}
fclose($filehandle);
?>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Help Me Humpa Forum Index -> Anything PHP All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum