Script
<?php
$handle = @fopen("/tmp/inputfile.txt", "r");
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
echo $buffer;
}
if (!feof($handle)) {
echo "Error: unexpected fgets() fail\n";
}
fclose($handle);
}
?>
According to the script this is reading the file untill the end and then it breaks. Is there easy way or function to keep the while function to loop and checking for new lines every 5 seconds after reaches end of file?
UPDATE While googling and checking any related post from stackoverflow I found the answer: How To watch a file write in PHP?
This is what I was looking for.