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<string, mixed>
Array of options/content for the HTTP stream context.
array<string, mixed>
Array of options/content for the SSL stream context.
resource|null
The stream resource.
Builds the request content based on the request object.
Build the stream context out of the request object.
Build the header context for the request.
Build miscellaneous options for the request.
Build a response object
Build SSL options for the request.
Open the socket and handle any connection errors.
Open the stream and send the request.
Get the context options
Create the response list based on the headers & content
Send a request and get a response back.
_buildContent(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void
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 {@link \Cake\Http\Client\FormData}
Psr\Http\Message\RequestInterface
$request The request being sent.
array<string, mixed>
$options Array of options to use.
void
_buildContext(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void
Build the stream context out of the request object.
Psr\Http\Message\RequestInterface
$request The request to build context from.
array<string, mixed>
$options Additional request options.
void
_buildHeaders(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void
Build the header context for the request.
Creates cookies & headers.
Psr\Http\Message\RequestInterface
$request The request being sent.
array<string, mixed>
$options Array of options to use.
void
_buildOptions(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void
Build miscellaneous options for the request.
Psr\Http\Message\RequestInterface
$request The request being sent.
array<string, mixed>
$options Array of options to use.
void
_buildResponse(array $headers, string $body): Cake\Http\Client\Response
Build a response object
array
$headers Unparsed headers.
string
$body The response body.
Cake\Http\Client\Response
_buildSslContext(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): void
Build SSL options for the request.
Psr\Http\Message\RequestInterface
$request The request being sent.
array<string, mixed>
$options Array of options to use.
void
_open(string $url, Psr\Http\Message\RequestInterface $request): void
Open the socket and handle any connection errors.
string
$url The url to connect to.
Psr\Http\Message\RequestInterface
$request The request object.
void
Psr\Http\Client\RequestExceptionInterface
_send(Psr\Http\Message\RequestInterface $request): array
Open the stream and send the request.
Psr\Http\Message\RequestInterface
$request The request object.
array
Psr\Http\Client\NetworkExceptionInterface
contextOptions(): array<string, mixed>
Get the context options
Useful for debugging and testing context creation.
array<string, mixed>
createResponses(array $headers, string $content): arrayCake\Http\Client\Response>
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.
arrayCake\Http\Client\Response>
send(Psr\Http\Message\RequestInterface $request, array<string, mixed> $options): arrayCake\Http\Client\Response>
Send a request and get a response back.
Psr\Http\Message\RequestInterface
$request array<string, mixed>
$options arrayCake\Http\Client\Response>
Connection error list.
array
Context resource used by the stream API.
resource|null
Array of options/content for the HTTP stream context.
array<string, mixed>
Array of options/content for the SSL stream context.
array<string, mixed>
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.4/class-Cake.Http.Client.Adapter.Stream.html