Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

output of process to web page

Status
Not open for further replies.

jlynch1

Technical User
Dec 20, 2001
100
IE
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.

Code:
        $fp = popen("ping -c 15 -i .25 140.203.16.5 &", "r");

        while (!feof($fp)) {
                $buffer = trim(fgets($fp, 255));
                echo $buffer . &quot;<br>\n&quot;;
        }

        pclose($fp);

and

        system.exec(&quot;ping -c 15 -i .25 140.203.16.5 &&quot;,$output);

        for($i=0; $i < count($output); $i++)
        {
                echo $output[$i] . &quot;<br>&quot;;
        }

Does anyone know how i would go about doing such a thing ?
 
Flushing the output stream after each print should do what you want. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top