Fr3nch13/CakePHP Utilities

Curl
in package
implements AdapterInterface

Implements sending Cake\Http\Client\Request via ext/curl.

In addition to the standard options documented in , this adapter supports all available curl options. Additional curl options can be set via the curl option key when making requests or configuring a client.

Table of Contents

Interfaces

AdapterInterface
Http client adapter interface.

Methods

buildOptions()  : array<string|int, mixed>
Convert client options into curl options.
send()  : array<string|int, Response>
Send a request and get a response back.
createResponse()  : array<string|int, Response>
Convert the raw curl response into an Http\Client\Response
exec()  : string|bool
Execute the curl handle.
getProtocolVersion()  : int
Convert HTTP version number into curl value.

Methods

buildOptions()

Convert client options into curl options.

public buildOptions(RequestInterface $request, array<string, mixed> $options) : array<string|int, mixed>
Parameters
$request : RequestInterface

The request.

$options : array<string, mixed>

The client options

Return values
array<string|int, mixed>

send()

Send a request and get a response back.

public send(RequestInterface $request, array<string|int, mixed> $options) : array<string|int, Response>
Parameters
$request : RequestInterface

The request object to send.

$options : array<string|int, mixed>

Array of options for the stream.

Tags
inheritDoc
Return values
array<string|int, Response>

Array of populated Response objects

createResponse()

Convert the raw curl response into an Http\Client\Response

protected createResponse(resource|CurlHandle $handle, string $responseData) : array<string|int, Response>
Parameters
$handle : resource|CurlHandle

Curl handle

$responseData : string

string The response data from curl_exec

Tags
psalm-suppress

UndefinedDocblockClass

Return values
array<string|int, Response>

exec()

Execute the curl handle.

protected exec(resource|CurlHandle $ch) : string|bool
Parameters
$ch : resource|CurlHandle

Curl Resource handle

Tags
psalm-suppress

UndefinedDocblockClass

Return values
string|bool

getProtocolVersion()

Convert HTTP version number into curl value.

protected getProtocolVersion(RequestInterface $request) : int
Parameters
$request : RequestInterface

The request to get a protocol version for.

Return values
int

        
On this page

Search results