The script executes multiple URL's at once, and automatically echo the content of the URL, I want to prevent this script from echoing anything, but I don't see any line like echo 'something';
except the lines I commented out.
This is the script:
function batch_execute($urls) { $i = 0; $block = array(); $curl_handles = array(); foreach ($urls as $url) { $curl_handles[$url] = curl_init(); curl_setopt($curl_handles[$url], CURLOPT_URL, $url); curl_setopt($curl_handles[$url], CURLOPT_CONNECTTIMEOUT, 100); } $curl_multi_handle = curl_multi_init(); foreach ($curl_handles as $a_curl_handle) { $i++; curl_multi_add_handle($curl_multi_handle, $a_curl_handle); $block[] = $a_curl_handle; if (($i % 10 == 0) or ($i == count($curl_handles))) { $running = NULL; do { $running_before = $running; curl_multi_exec($curl_multi_handle, $running); if ($running != $running_before) { // echo("Waiting for $running sites to finish...\n"); } } while ($running > 0); foreach ($block as $handle) { // $code = curl_getinfo($handle, CURLINFO_HTTP_CODE); // $curl_errno = curl_errno($handle); $curl_error = curl_error($handle); if ($curl_error) { // echo(" *** cURL error: ($curl_errno) $curl_error\n"); } curl_multi_remove_handle($curl_multi_handle, $handle); } $block = array(); } } curl_multi_close($curl_multi_handle); }
Help :)
ob_start()
). – MattCURLOPT_NOBODY
totrue
. – Kermitob_end_clean()
– Thomas Claysonob_end_clean()
– Thomas Clayson