Implements sending Cake\Http\Client\Request via php's stream API.
This approach and implementation is partly inspired by Aura.Http
array
Connection error list.
resource|null
Context resource used by the stream API.
array
Array of options/content for the HTTP stream context.
array
Array of options/content for the SSL stream context.
resource|null
The stream resource.
_buildContent(\Psr\Http\Message\RequestInterface $request, array $options)
Builds the request content based on the request object.
If the $request->body() is a string, it will be used as is. Array data will be processed with Cake\Http\Client\FormData
\Psr\Http\Message\RequestInterface
$request The request being sent.
array
$options Array of options to use.
_buildContext(\Psr\Http\Message\RequestInterface $request, array $options)
Build the stream context out of the request object.
\Psr\Http\Message\RequestInterface
$request The request to build context from.
array
$options Additional request options.
_buildHeaders(\Psr\Http\Message\RequestInterface $request, array $options)
Build the header context for the request.
Creates cookies & headers.
\Psr\Http\Message\RequestInterface
$request The request being sent.
array
$options Array of options to use.
_buildOptions(\Psr\Http\Message\RequestInterface $request, array $options)
Build miscellaneous options for the request.
\Psr\Http\Message\RequestInterface
$request The request being sent.
array
$options Array of options to use.
_buildResponse(array $headers, string $body)
Build a response object
array
$headers Unparsed headers.
string
$body The response body.
\Cake\Http\Client\Response
_buildSslContext(\Psr\Http\Message\RequestInterface $request, array $options)
Build SSL options for the request.
\Psr\Http\Message\RequestInterface
$request The request being sent.
array
$options Array of options to use.
_open(string $url, \Psr\Http\Message\RequestInterface $request)
Open the socket and handle any connection errors.
string
$url The url to connect to.
\Psr\Http\Message\RequestInterface
$request The request object.
Psr\Http\Client\RequestExceptionInterface
_send(\Psr\Http\Message\RequestInterface $request)
Open the stream and send the request.
\Psr\Http\Message\RequestInterface
$request The request object.
array
Array of populated Response objects
Psr\Http\Client\NetworkExceptionInterface
contextOptions()
Get the context options
Useful for debugging and testing context creation.
array
createResponses(array $headers, string $content)
Create the response list based on the headers & content
Creates one or many response objects based on the number of redirects that occurred.
array
$headers The list of headers from the request(s)
string
$content The response content.
\Cake\Http\Client\Response[]
The list of responses from the request(s)
send(\Psr\Http\Message\RequestInterface $request, array $options)
Send a request and get a response back.
\Psr\Http\Message\RequestInterface
$request The request object to send.
array
$options Array of options for the stream.
\Cake\Http\Client\Response[]
Array of populated Response objects
Connection error list.
array
Context resource used by the stream API.
resource|null
Array of options/content for the HTTP stream context.
array
Array of options/content for the SSL stream context.
array
The stream resource.
resource|null
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Http.Client.Adapter.Stream.html