class Native extends Client

Properties

bool $sslVerifyPeer from  Client
int $timeout from  Client
bool $gzipEnabled

Methods

string|bool
get(string $url, array $options = [])

Execute a GET request and return the response's body

string|bool
post(string $url, array $options = [], string $body = '')

Execute a POST request and return the response's body

__construct()

Constructor

resource
createContext(string $method, array $options, string $body)

Create a stream context for given request

string
decompress(string $content)

Decompress given page if applicable

string[]
generateHeaders(array $options, string $body)

Generate a list of headers for given request

string|bool
request(string $method, string $url, array $options, string $body = '')

Execute an HTTP request

Details

at line 30
string|bool get(string $url, array $options = [])

Execute a GET request and return the response's body

Parameters

string $url

Request URL

array $options

Request options

Return Value

string|bool

Response content or FALSE

at line 38
string|bool post(string $url, array $options = [], string $body = '')

Execute a POST request and return the response's body

Parameters

string $url

Request URL

array $options

Request options

string $body

Request body

Return Value

string|bool

Response content or FALSE

at line 22
__construct()

Constructor

at line 51
protected resource createContext(string $method, array $options, string $body)

Create a stream context for given request

Parameters

string $method

Request method

array $options

Request options

string $body

Request body

Return Value

resource

at line 73
protected string decompress(string $content)

Decompress given page if applicable

Parameters

string $content

Response body, potentially compressed

Return Value

string

Response body, uncompressed

at line 90
protected string[] generateHeaders(array $options, string $body)

Generate a list of headers for given request

Parameters

array $options

Request options

string $body

Request body

Return Value

string[]

at line 111
protected string|bool request(string $method, string $url, array $options, string $body = '')

Execute an HTTP request

Parameters

string $method

Request method

string $url

Request URL

array $options

Request options

string $body

Request body

Return Value

string|bool

Response body or FALSE