Click to See Complete Forum and Search --> : php question


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 ?

EscapeCharacter
02-25-2003, 07:54 AM
you could try pinging just once in loop that does it fifteen times setting -c to 1

ejlynch
02-25-2003, 08:19 AM
I was just using ping as an example.

I need to run a program that ouputs text every so often. It would be something like the traceroute program i linked to.