NULL
])Retrieve the corresponding response of an already finished request, or the last received response if $request is not set.
NOTE:
If $request isNULL
, then the response is removed from the internal storage (stack-like operation).
NULL
, if no more response was available to pop, when no $request was given.
<?php
$client = new http\Client;
$client->enqueue(new http\Client\Request("GET", "http://php.net"));
$client->enqueue(new http\Client\Request("GET", "http://pecl.php.net"));
$client->enqueue(new http\Client\Request("GET", "http://pear.php.net"));
$client->send();
while ($res = $client->getResponse()) {
printf("%s returned %d\n", $res->getTransferInfo("effective_url"),
$res->getResponseCode());
}
Yields:
http://php.net/ returned 200
http://pecl.php.net/ returned 200
http://pear.php.net/ returned 200