* Thus wrote CurlyBraces Technologies ( Pvt ) Ltd ([EMAIL PROTECTED]):
> hi friends , 
> 
> I have a log file that is creating while running a perl script.That log can i read ( 
> using, tail -f log.file ) in to a web interface from php ? 
> Is there any possibility , plz help ..........,

You can possibly do something with using
popen and some connection handling functions.

/* ensure the script wont time out */
set_time_limit(0);  

/* send data after each echo */
ini_set('implicit_flush', 1);

/* watch for canceled request */
ignore_user_abort(false);

/* open a process file pointer */
$pfp = popen('tail -f log.file', 'r');

/* make sure it worked */
if (! $pfp ) {
  die('Can\'t open file');
}

/* continue while the user hasn't aborted or 
   we've still have a connection */
while (! connection_aborted() ) {
  /* get a line and echo the contents
     from the file pointer opened */
  echo fgets($pfp);
}

/* close the process file pointer */
fclose($pfp);

See: 
http://us2.php.net/manual/en/features.connection-handling.php
http://php.net/popen
http://php.net/ini_set


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to