By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,722 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,722 IT Pros & Developers. It's quick & easy.

Print Output from log File

P: n/a
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);
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.