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.
I have tried using the following code but both hang until the process finishes and then prints the output.
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.
I have tried using the following code but both hang until the process finishes and then prints the output.
Code:
$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 ?