diff options
-rw-r--r-- | it_url.class | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/it_url.class b/it_url.class index 7b364d2..e3139c8 100644 --- a/it_url.class +++ b/it_url.class @@ -310,6 +310,7 @@ function request($p=array()) * @param $p['totaltimeout']: timeout for the whole function call (fractions allowed) * @param $p['headers']: optional array of HTTP headers to send * @param $p['parallel']: max number of parallel requests + * @param $p['noresults']: do not keep results around * @return array of contents (or false for errors like timesou) of resulting page using same * keys as the urls input array, considering redirects, excluding headers */ @@ -375,15 +376,16 @@ function get_multi($p=null) $closehandle($key); EDC('reqtimings', $key, $info['result'], (gettimeofday(true) - $start) * 1000); - if ($info['result'] == CURLE_OK) - $results_unordered[$key] = $content; - else if($retries[$key]++ < $p['retries']) + if ($info['result'] == CURLE_OK) { + if (!$p['noresults']) + $results_unordered[$key] = $content; + } else if($retries[$key]++ < $p['retries']) $addhandle($key); else $results_unordered[$key] = false; - if (($handler = $urls[$keys[$info['handle']]]['handler'])) - $abort = $handler($info['result'], $results_unordered[$key]); + if (($handler = $urls[$key]['handler'])) + $abort = $handler($info['result'], $content); if (!$abort && count($handles) < $parallel && $tofetch) $addhandle(array_shift($tofetch)); @@ -397,7 +399,7 @@ function get_multi($p=null) $closehandle($key); curl_multi_close($mh); - return it::filter_keys($results_unordered, array_keys($urls), ['reorder' => true]); + return $p['noresults'] ? null : it::filter_keys($results_unordered, array_keys($urls), ['reorder' => true]); } /** |