Container class for cookies used in Http\Client.
Provides cookie jar like features for storing cookies between requests, as well as appending cookies to new requests.
Provides an interface for building multipart/form-encoded message bodies.
Used by Http\Client to upload POST/PUT data and files.
Contains the data and behavior for a single part in a Multipart FormData request body.
Added to Cake\Http\Client\FormData when sending data to a remote server.
Base class for other HTTP requests/responses
Defines some common helper methods, constants and properties.
Implements methods for HTTP requests.
Used by Cake\Http\Client to contain request information for making requests.
Implements methods for HTTP responses.
All of the following examples assume that $response is an
instance of this class.
Header names are case-insensitive, but normalized to Title-Case when the response is parsed.
$val = $response->getHeaderLine('content-type');
Will read the Content-Type header. You can get all set headers using:
$response->getHeaders();
You can access the response body stream using:
$content = $response->getBody();
You can get the body string using:
$content = $response->getStringBody();
If your response body is in XML or JSON you can use special content type specific accessors to read the decoded data. JSON data will be returned as arrays, while XML data will be returned as SimpleXML nodes:
// Get as xml
$content = $response->getXml()
// Get as json
$content = $response->getJson()
If the response cannot be decoded, null will be returned.
You can access the response status code using:
$content = $response->getStatusCode();