| View previous topic :: View next topic |
| Author |
Message |
bobhinkle
Joined: 13 Oct 2006 Posts: 68
|
Posted: Fri Oct 13, 2006 1:35 pm Post subject: Create file |
|
|
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 |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Fri Oct 13, 2006 1:48 pm Post subject: |
|
|
| Try using the full path - and try chmodding the hottproxy directory to 777 - see if that does anything |
|
| Back to top |
|
 |
bobhinkle
Joined: 13 Oct 2006 Posts: 68
|
Posted: Tue Oct 24, 2006 5:14 pm Post subject: ok |
|
|
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 |
|
 |
Humpa Site Admin

Joined: 06 Nov 2005 Posts: 10258
|
Posted: Thu Oct 26, 2006 11:37 am Post subject: |
|
|
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 |
|
 |
|