I am building a web interface for a C# app. Due to the project specifications, I cannot use ASP.Net to do that, so I'm using HTML.
My C# app has some console output that displays the current status of the app. I want to display that output on my web page using a PHP script. I am using an iframe like so:
<iframe id="appLog" src="php/startApp.php"></iframe>
and I test my PHP script by pinging google 5 times:
<?php
$cmd = "ping 127.0.0.1 -c 5";
ob_implicit_flush(true);
ob_start();
echo '<pre>';
ob_flush();
$proc = popen($cmd, 'r');
while (!feof($proc))
{
echo fread($proc, 4096);
ob_flush();
}
echo '</pre>';
ob_end_flush();
?>
However, theping
output is only displayed after the process completes. I have tried multiple approaches already, and in every one I can only see the command's output after the process is done. I need the output to be displayed in real-time in a browser window.
Is there any way I can accomplish this in PHP?