ejlynch
02-25-2003, 07:00 AM
I want to be able to execute a process using php on my machine and send all the output to a webpage in real time.
An example of the type of thing i am looking to do can be found at the following address.
http://www.above.net/cgi-bin/trace?140.203.56.30
I have tried using the following code but both hang until the process finishes and then prints the output.
$fp = popen("ping -c 15 -i .25 140.203.16.5 &", "r");
while (!feof($fp)) {
$buffer = trim(fgets($fp, 255));
echo $buffer . "<br>\n";
}
pclose($fp);
and
system.exec("ping -c 15 -i .25 140.203.16.5 &",$output);
for($i=0; $i < count($output); $i++)
{
echo $output[$i] . "<br>";
}
Does anyone know how i would go about doing such a thing ?
An example of the type of thing i am looking to do can be found at the following address.
http://www.above.net/cgi-bin/trace?140.203.56.30
I have tried using the following code but both hang until the process finishes and then prints the output.
$fp = popen("ping -c 15 -i .25 140.203.16.5 &", "r");
while (!feof($fp)) {
$buffer = trim(fgets($fp, 255));
echo $buffer . "<br>\n";
}
pclose($fp);
and
system.exec("ping -c 15 -i .25 140.203.16.5 &",$output);
for($i=0; $i < count($output); $i++)
{
echo $output[$i] . "<br>";
}
Does anyone know how i would go about doing such a thing ?