Response (class)

Class Response

Implements methods for HTTP responses.

All of the following examples assume that $response is an instance of this class.

Get header values

Header names are case-insensitive, but normalized to Title-Case when the response is parsed.

$val = $response->header('content-type');

Will read the Content-Type header. You can get all set headers using:

$response->header();

You can also get at the headers using object access. When getting headers with object access, you have to use case-sensitive header names:

$val = $response->headers['Content-Type'];

Get the response body

You can access the response body using:

$content = $response->body();

You can also use object access:

$content = $response->body;

If your