/** * Retry all failed requests of the given array of Curl instances. * * @param array $curlInstances An array of Curl instances of which failed ones should be retried * * @return int The number of failed requests which were retried. */ public function retryFailed($curlInstances) { $failed = 0; $curlMultiInstance = new CurlMulti(); /** * @var $curlInstance Curl */ foreach ($curlInstances as $curlInstance) { if ($curlInstance->isSuccessful()) { continue; } $curlInstance->setRetryCount($curlInstance->getRetryCount() + 1); $curlMultiInstance->addInstance($curlInstance); $failed++; } $curlMultiInstance->exec(); return $failed; }