Properties

$resource

$resource : resource

Client resource object

Type

resource

$url

$url : string

URL

Type

string

$method

$method : string

Method

Type

string

$fields

$fields : array

Fields

Type

array

$query

$query : string

Query

Type

string

$requestHeaders

$requestHeaders : array

Request headers

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

$responseHeader

$responseHeader : string

Raw response header

Type

string

$responseHeaders

$responseHeaders : array

Response headers

Type

array

$body

$body : string

Response body

Type

string

$context

$context : resource

Stream context

Type

resource

$contextOptions

$contextOptions : array

Stream context options

Type

array

$contextParams

$contextParams : array

Stream context parameters

Type

array

$httpResponseHeaders

$httpResponseHeaders : string

HTTP Response Headers

Type

string

$mode

$mode : string

Stream mode

Type

string

Methods

getUrl()

getUrl() : string

Get the URL

Returns

string

setMethod()

setMethod(string  $method) : \Pop\Http\Client\Stream

Set the method

Parameters

string $method

Throws

\Pop\Http\Client\Exception

Returns

\Pop\Http\Client\Stream

getMethod()

getMethod() : string

Get the method

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

prepareQuery()

prepareQuery() : string

Prepare the HTTP query

Returns

string

getQuery()

getQuery() : string

Get HTTP query

Returns

string

getQueryLength()

getQueryLength(boolean  $mb = true) : integer

Get HTTP query length

Parameters

boolean $mb

Returns

integer

setRequestHeader()

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

Set a request header

Parameters

string $name
string $value

Returns

\Pop\Http\Client\AbstractClient

setRequestHeaders()

setRequestHeaders(array  $headers) : \Pop\Http\Client\AbstractClient

Set all request headers

Parameters

array $headers

Returns

\Pop\Http\Client\AbstractClient

getRequestHeader()

getRequestHeader(string  $name) : mixed

Get a request header

Parameters

string $name

Returns

mixed

getRequestHeaders()

getRequestHeaders() : array

Get all request headers

Returns

array

hasRequestHeaders()

hasRequestHeaders() : boolean

Determine if there are request headers

Returns

boolean

getResponseHeader()

getResponseHeader(string  $name) : mixed

Get a response header

Parameters

string $name

Returns

mixed

getResponseHeaders()

getResponseHeaders() : array

Get all response headers

Returns

array

hasResponseHeaders()

hasResponseHeaders() : boolean

Determine if there are response headers

Returns

boolean

getRawResponseHeader()

getRawResponseHeader() : string

Get raw response header

Returns

string

getBody()

getBody() : string

Get the response body

Returns

string

getCode()

getCode() : string

Get the response code

Returns

string

isSuccess()

isSuccess() : boolean

Determine if the response is a success

Returns

boolean

isRedirect()

isRedirect() : boolean

Determine if the response is a redirect

Returns

boolean

isError()

isError() : boolean

Determine if the response is an error

Returns

boolean

isClientError()

isClientError() : boolean

Determine if the response is a client error

Returns

boolean

isServerError()

isServerError() : boolean

Determine if the response is a server error

Returns

boolean

getHttpVersion()

getHttpVersion() : string

Get the response HTTP version

Returns

string

getMessage()

getMessage() : string

Get the 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 an 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, string  $method = 'GET', string  $mode = 'r', array  $options = array(), array  $params = array()) 

Constructor

Instantiate the stream object

Parameters

string $url
string $method
string $mode
array $options
array $params

stream()

stream() : resource

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

Returns

resource

addContextOption()

addContextOption(string  $name, mixed  $option) : \Pop\Http\Client\Stream

Add a context options

Parameters

string $name
mixed $option

Returns

\Pop\Http\Client\Stream

addContextParam()

addContextParam(string  $name, mixed  $param) : \Pop\Http\Client\Stream

Add a context parameter

Parameters

string $name
mixed $param

Returns

\Pop\Http\Client\Stream

setContextOptions()

setContextOptions(array  $options) : \Pop\Http\Client\Stream

Set the context options

Parameters

array $options

Returns

\Pop\Http\Client\Stream

setContextParams()

setContextParams(array  $params) : \Pop\Http\Client\Stream

Set the context parameters

Parameters

array $params

Returns

\Pop\Http\Client\Stream

setMode()

setMode(string  $mode) : \Pop\Http\Client\Stream

Set the mode

Parameters

string $mode

Returns

\Pop\Http\Client\Stream

getContext()

getContext() : resource

Get the context resource

Returns

resource

getContextOptions()

getContextOptions() : array

Get the context options

Returns

array

getContextOption()

getContextOption(string  $name) : mixed

Get a context option

Parameters

string $name

Returns

mixed

hasContextOption()

hasContextOption(string  $name) : boolean

Determine if a context option has been set

Parameters

string $name

Returns

boolean

getContextParams()

getContextParams() : array

Get the context parameters

Returns

array

getContextParam()

getContextParam(string  $name) : mixed

Get a context parameter

Parameters

string $name

Returns

mixed

hasContextParam()

hasContextParam(string  $name) : boolean

Determine if a context parameter has been set

Parameters

string $name

Returns

boolean

getMode()

getMode() : string

Get the mode

Returns

string

disconnect()

disconnect() : void

Close the stream