Hi all
this is my PHP code to read a file that is dinamically created by a bash script
echo “
The file to be opened is “. $filetoplot. “
”;
//$filename = “1321291031.dat”;
if ($file_handle = fopen(”$filetoplot”, ‘r’)) {
while ( $line_of_text = fgets($file_handle) ) {
$parts = explode(’.’, $line_of_text);
echo $line_of_text ;
print $parts[0] . $parts[1]. $parts[2]. “
”;
}
fclose($file_handle);
}
The file(s) definitely exists and I have permissions to read on the target folder. When I leave the second line commented the code is not doing anything. If I uncomment that line then the code works perfectly. I added the first line to check that it is actually finding the file but it seems that fopen is not working… I guess I am doing something stupid since this is my first PHP code so I would appreciate any help.
Thanks in advance!