|
I my php script I call a perl script that perl script will create a log file
From the php script I want to read the log file and write the
output to the browser. This operation has to carried out for
till the perl script completes the process. This can be identifed
by [Process Completed] in the log file.
My problem is when I read the first line and print to the browser it
was going fine. Second time when the loop continues it print the sample
content again and again. This has to be avoided and it has the print the
new logs only. Or clear the previous output and print it fresh again.
Ex.
First time
Processing 1...
Second time
Processing 1...
Processing 1...
Processing 2...
Actually in the second time it should print only
Processing 1...
Processing 2...
Can any one guide me how to handle this situation.
My Code:
--------
while ($line = fgets($fp))
{
trim($line);
if ($line != "Completed")
{
print $line ."<BR>";
}
else
{
exit();
}
}
fclose($fp); |