I have a script that checks the status of a few hundred webpages. However, the script takes about 2 minutes to load, and the screen is blank until the script has finished running. Then all the data is outputted at once.
I want to output data while the script is still running. Here's part of my script:
foreach ($urls as $url){
$headers = get_headers($url,true);
$status = $headers[0];
list($protocol, $code, $message) = explode(' ',$status,3);
echo '<br>'.$url.'<br>'.$code.'<br>';
}
http://php.net/manual/en/function.flush.php contains the answer you seek.
Be aware this may negatively hit your performance, but it sounds like you're more interested in seeing it's progress. :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With