Connecting Tech Pros Worldwide Help | Site Map

Print Output from log File

  #1  
Old July 17th, 2005, 10:19 AM
Sure
Guest
 
Posts: 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);
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Extract string from log file Edwin.Madari@VerizonWireless.com answers 1 August 9th, 2008 05:25 PM
Re: Unable to write output from os.path.walk to a file. Jeff McNeil answers 0 June 27th, 2008 05:27 PM
Separate output for log file and stdout amit.uttam@gmail.com answers 5 June 27th, 2008 05:25 PM
extract text from log file using re Fabian Braennstroem answers 2 September 14th, 2007 02:15 PM