1 # http\Client http\Client::enqueue(http\Client\Request $request[, callable $cb])
3 Add another http\Client\Request to the request queue.
4 If the optional callback $cb returns true, the request will be automatically dequeued.
7 > The http\Client\Response object resulting from the request is always stored
8 > internally to be retreived at a later time, __even__ when $cb is used.
10 > If you are about to send a lot of requests and do __not__ need the response
11 > after executing the callback, you can use http\Client::getResponse() within
12 > the callback to keep the memory usage level as low as possible.
14 See http\Client::dequeue() and http\Client::send().
19 * http\Client\Request $request
20 The request to enqueue.
21 * Optional callable $cb
22 A callback to automatically call when the request has finished.
30 * http\Exception\InvalidArgumentException
31 * http\Exception\BadMethodCallException
32 * http\Exception\RuntimeException
36 (new http\Client)->enqueue(new http\Client\Request("GET", "http://php.net"),
37 function(http\Client\Response $res) {
38 printf("%s returned %d\n", $res->getTransferInfo("effective_url"), $res->getResponseCode());
39 return true; // dequeue
44 http://php.net/ returned 200