Properties

$resource

$resource : resource

Client resource object

Type

resource

$url

$url : string

URL

Type

string

$fields

$fields : array

Fields

Type

array

$version

$version : string

HTTP version from response

Type

string

$code

$code : integer

Response code

Type

integer

$message

$message : string

Response message

Type

string

$response

$response : string

Raw response string

Type

string

$header

$header : string

Raw response header

Type

string

$headers

$headers : array

Response headers

Type

array

$body

$body : string

Response body

Type

string

$options

$options : array

cURL options

Type

array

Methods

getUrl()

getUrl() : string

Get the URL

Returns

string

setField()

setField(string  $name, mixed  $value) : \Pop\Http\Client\AbstractClient

Set a field

Parameters

string $name
mixed $value

Returns

\Pop\Http\Client\AbstractClient

getField()

getField(string  $name) : mixed

Get a field

Parameters

string $name

Returns

mixed

getFields()

getFields() : array

Get all field

Returns

array

getHeader()

getHeader(string  $name) : mixed

Get a response header

Parameters

string $name

Returns

mixed

getHeaders()

getHeaders() : array

Get all response headers

Returns

array

getRawHeader()

getRawHeader() : string

Get raw response header

Returns

string

getBody()

getBody() : string

Get the cURL response body

Returns

string

getCode()

getCode() : string

Get the cURL response code

Returns

string

getHttpVersion()

getHttpVersion() : string

Get the cURL response HTTP version

Returns

string

getMessage()

getMessage() : string

Get the cURL response HTTP message

Returns

string

getResponse()

getResponse() : string

Get the raw response

Returns

string

hasResource()

hasResource() : boolean

Determine whether or not resource is available

Returns

boolean

getResource()

getResource() : resource

Get the resource

Returns

resource

decodeBody()

decodeBody() : void

Decode the body

throwError()

throwError(string  $error) : void

Throw an exception upon a cURL error.

Parameters

string $error

Throws

\Pop\Http\Client\Exception

send()

send() : void

Method to send the request and get the response

__construct()

__construct(string  $url, array  $opts = null) 

Constructor

Instantiate the cURL object

Parameters

string $url
array $opts

Throws

\Pop\Http\Client\Exception

curl()

curl() : resource

Return cURL resource (alias to $this->getResource())

Returns

resource

setOption()

setOption(integer  $opt, string  $val) : \Pop\Http\Client\Curl

Set cURL session option

Parameters

integer $opt
string $val

Returns

\Pop\Http\Client\Curl

setOptions()

setOptions(array  $opts) : \Pop\Http\Client\Curl

Set cURL session options

Parameters

array $opts

Returns

\Pop\Http\Client\Curl

setReturnHeader()

setReturnHeader(boolean  $header = true) : \Pop\Http\Client\Curl

Set cURL option to return the header

Parameters

boolean $header

Returns

\Pop\Http\Client\Curl

setReturnTransfer()

setReturnTransfer(boolean  $transfer = true) : \Pop\Http\Client\Curl

Set cURL option to return the transfer

Parameters

boolean $transfer

Returns

\Pop\Http\Client\Curl

isReturnHeader()

isReturnHeader() : boolean

Check if cURL is set to return header

Returns

boolean

isReturnTransfer()

isReturnTransfer() : boolean

Check if cURL is set to return transfer

Returns

boolean

isPost()

isPost() : boolean

Check if cURL is set to POST

Returns

boolean

getOption()

getOption(integer  $opt) : string

Get a cURL session option

Parameters

integer $opt

Returns

string

getInfo()

getInfo(integer  $opt = null) : array|string

Return the cURL session last info

Parameters

integer $opt

Returns

array|string

version()

version() : array

Return the cURL version

Returns

array

disconnect()

disconnect() : void

Close the cURL connection

parseHeaders()

parseHeaders() : void

Parse headers