Responses
Responses are the HTTP messages a client receives from a server after sending an HTTP request message.
Start-Line
The start-line of a response contains the protocol and protocol version, status code, and reason phrase.
1. $client = new \GuzzleHttp\Client();
2. $response = $client->request('GET', 'http://httpbin.org/get');
4. echo $response->getStatusCode(); // 200
5. echo $response->getReasonPhrase(); // OK
6. echo $response->getProtocolVersion(); // 1.1
Body
As described earlier, you can get the body of a response using the getBody() method.
1. $body = $response->getBody();
2. echo $body;
3. // Cast to a string: { ... }
4. $body->seek(0);
5. // Rewind the body
6. $body->read(1024);
7. // Read bytes of the body
