/** * Removes access to {@link Curl::$ch $ch} from a {@link CurlParallel} object. * * @param CurlParallel $mh The CurlParallel object that no longer needs {@link Curl::$ch $ch}. */ public function revoke(CurlParallel $mh) { $mh->release($this->ch); $this->multi = false; }
throw new Exception("I couldn't fetch the response."); } printf("Single request: Success: %s\n", $response); printf("I downloaded %n bytes!\n", $curl->info('size_download')); // Now we'll test the parallel processor /** * Let's fetch Yahoo */ $y = new Curl("http://www.yahoo.com/"); /** * And let's grab Google, too */ $g = new Curl("http://www.google.com/"); /** * Create a CurlParallel object */ $m = new CurlParallel($y, $g); $m->exec(); if (strlen($g->fetch()) && strlen($y->fetch())) { printf("Parallel requests: Success!"); } else { throw new Exception("Could not run in parallel."); } } catch (Exception $e) { // There was a problem! What happened? printf("Oh Noes!\n"); printf("%s\n", $e->getMessage()); if ($curl) { printf("cURL error: %s\n", $curl->errno()); } }