\AdventureRes\HttpClients AdventureResCurlHttpClient

Class AdventureResCurlHttpClient

Summary

Methods
Properties
Constants
__call()
__construct()
send()
openConnection()
closeConnection()
sendRequest()
compileRequestHeaders()
extractResponseHeadersAndBody()
No public properties found
CURL_PROXY_QUIRK_VER
CONNECTION_ESTABLISHED
No protected methods found
$errorMessage
$errorCode
$rawResponse
$adventureResCurl
N/A
getHeaderSize()
No private properties found
N/A

Constants

CURL_PROXY_QUIRK_VER

CURL_PROXY_QUIRK_VER

CONNECTION_ESTABLISHED

CONNECTION_ESTABLISHED

Properties

$errorMessage

$errorMessage : string

Type

string — The client error message

$errorCode

$errorCode : integer

Type

integer — The curl client error code

$rawResponse

$rawResponse : string|boolean

Type

string|boolean — The raw response from the server

Methods

__call()

__call(  $command,   $arguments) 

Parameters

$command
$arguments

send()

send(string  $url, string  $method, string  $body, array  $headers, integer  $timeOut) : \AdventureRes\Http\ApiRawResponse

Sends a request to the server and returns the raw response.

Parameters

string $url

The endpoint to send the request to.

string $method

The request method.

string $body

The body of the request.

array $headers

The request headers.

integer $timeOut

The timeout in seconds for the request.

Returns

\AdventureRes\Http\ApiRawResponse

Raw response from the server.

openConnection()

openConnection(string  $url, string  $method, string  $body, array  $headers, integer  $timeOut) 

Opens a new curl connection.

Parameters

string $url

The endpoint to send the request to.

string $method

The request method.

string $body

The body of the request.

array $headers

The request headers.

integer $timeOut

The timeout in seconds for the request.

closeConnection()

closeConnection() 

Closes an existing curl connection

sendRequest()

sendRequest() 

Send the request and get the raw response from curl

compileRequestHeaders()

compileRequestHeaders(array  $headers) : array

Compiles the request headers into a curl-friendly format.

Parameters

array $headers

The request headers.

Returns

array

extractResponseHeadersAndBody()

extractResponseHeadersAndBody() : array

Extracts the headers and the body into a two-part array

Returns

array

getHeaderSize()

getHeaderSize() : integer

Return proper header size

Returns

integer