Properties

$url

$url : string

URL

Type

string

$method

$method : string

Method

Type

string

$resource

$resource : resource

Client resource object

Type

resource

$context

$context : resource

Stream context

Type

resource

$contextOptions

$contextOptions : array

Stream context options

Type

array

$contextParams

$contextParams : array

Stream context parameters

Type

array

$mode

$mode : string

Stream mode

Type

string

$httpResponseHeaders

$httpResponseHeaders : array

HTTP response headers

Type

array

Methods

__construct()

__construct(string  $url = null, 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

getUrl()

getUrl() : string

Get the URL

Returns

string

setMethod()

setMethod(string  $method, boolean  $strict = true) : \Pop\Http\Client\Stream

Set the method

Parameters

string $method
boolean $strict

Throws

\Pop\Http\Client\Exception

Returns

\Pop\Http\Client\Stream

getMethod()

getMethod() : string

Get the method

Returns

string

hasResource()

hasResource() : boolean

Determine whether or not resource is available

Returns

boolean

getResource()

getResource() : resource

Get the resource

Returns

resource

resource()

resource() : resource

Get the resource (alias method)

Returns

resource

hasRequest()

hasRequest() : boolean

Has request object

Returns

boolean

hasResponse()

hasResponse() : boolean

Has response object

Returns

boolean

getParsedResponse()

getParsedResponse() : mixed

Get the parsed response

Returns

mixed

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

addRequestHeaders()

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

Add request headers

Parameters

array $headers

Returns

\Pop\Http\Client\AbstractClient

addRequestHeader()

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

Add request header

Parameters

string $name
string $value

Returns

\Pop\Http\Client\AbstractClient

hasRequestHeaders()

hasRequestHeaders() : boolean

Has request headers

Returns

boolean

hasRequestHeader()

hasRequestHeader(string  $name) : boolean

Has request header

Parameters

string $name

Returns

boolean

getRequestHeaders()

getRequestHeaders() : array

Get the request headers

Returns

array

getRequestHeader()

getRequestHeader(string  $name) : mixed

Get the request header

Parameters

string $name

Returns

mixed

getRequestBody()

getRequestBody() : string

Get the request body

Returns

string

isJson()

isJson() : boolean

Check if request is JSON

Returns

boolean

createUrlEncodedForm()

createUrlEncodedForm() : \Pop\Http\Client\AbstractClient

Create request as a URL-encoded form

Returns

\Pop\Http\Client\AbstractClient

isUrlEncodedForm()

isUrlEncodedForm() : boolean

Check if request is a URL-encoded form

Returns

boolean

isMultipartForm()

isMultipartForm() : boolean

Check if request is a multipart form

Returns

boolean

addResponseHeaders()

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

Add response headers

Parameters

array $headers

Returns

\Pop\Http\Client\AbstractClient

addResponseHeader()

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

Add response header

Parameters

string $name
string $value

Returns

\Pop\Http\Client\AbstractClient

hasResponseHeaders()

hasResponseHeaders() : boolean

Has response headers

Returns

boolean

hasResponseHeader()

hasResponseHeader(string  $name) : boolean

Has response header

Parameters

string $name

Returns

boolean

getResponseHeaders()

getResponseHeaders() : array

Get the response headers

Returns

array

getResponseHeader()

getResponseHeader(string  $name) : mixed

Get the response header

Parameters

string $name

Returns

mixed

getResponseBody()

getResponseBody() : string

Get the response body

Returns

string

getResponseCode()

getResponseCode() : string

Get the response code

Returns

string

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

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