I have a PHP script that makes a bunch of cURL requests. After each cURL request, I want to echo out some data, but presently, data only gets echoed out after every 5-10 cURL requests.
I've tried using ob_flush
and flush
, but it doesn't seem to make a difference. The following is the basic flow of my script:
<?php
header('Content-Type: text/html; charset=UTF-8');
set_time_limit(0);
ob_start();
$arr = array(); // Lots of strings in this array
foreach ($arr as $elem) {
// Use $elem to make cURL request and return HTML.
// Run regexes on returned HTML.
echo '<pre>';
print_r($matches[1]);
print_r($matches[2]);
echo '</pre>';
ob_flush();
flush();
}
Is there anything I can do to force the script to output the echoed/print_r
'ed data after each iteration of the foreach loop?
Thank you very much.