Client
class Client
Methods
Add Http headers to the request
A DELETE
request
A GET
request
A HEAD
request
No description
Register a callback (or anything but null
) for any request result - acts as a catch-all for missing handlers
Register a callback (or anything but null
) for an errored response
Register a callback (or anything but null
) for a failed response
Register a callback (or anything but null
) for a successful response
An OPTIONS
request
A PATCH
request
A POST
request
A PUT
request
Set the resetHandlers
property
Save the cliCall
into the provided variable
Save the raw response into the provided variable
Save the Http code into the provided variable
Save the response handler into the provided variable
Save the response headers into the provided variable
Set the destination
Set the Http headers for the request
Set whether POST data
is multipart/form-data
Set the user agent string for all requests
A TRACE
request
Details
at line line 78
__construct($destination, null|string|ResponseHandler $responseHandler = null)
Client constructor
The scheme for the destination defaults to https://
if it is not provided
at line line 93
$this
addHeaders(array $headers)
Add Http headers to the request
at line line 109
$this|mixed
delete(string $page, array|string $data = array())
A DELETE
request
at line line 128
$this|mixed
get(string $page, array|string $data = array(), string $body = '')
A GET
request
To send query string parameters, $data
must be an associative array.
To send only a body, $data
can be a string, and the $body
argument will be ignored.
Of course, to use both, send an array and a string.
at line line 147
$this|mixed
head(string $page)
A HEAD
request
at line line 152
insecure($isInsecure = true)
at line line 169
$this
onAny(mixed $callback)
Register a callback (or anything but null
) for any request result - acts as a catch-all for missing handlers
The callback will receive the response handler as the first argument. Optional extra arguments may be passed here that will also be provided to the callback when invoked.
at line line 189
$this
onError(mixed $callback)
Register a callback (or anything but null
) for an errored response
The callback will receive the response handler as the first argument. Optional extra arguments may be passed here that will also be provided to the callback when invoked.
at line line 209
$this
onFailure(mixed $callback)
Register a callback (or anything but null
) for a failed response
The callback will receive the response handler as the first argument. Optional extra arguments may be passed here that will also be provided to the callback when invoked.
at line line 229
$this
onSuccess(mixed $callback)
Register a callback (or anything but null
) for a successful response
The callback will receive the response handler as the first argument Optional extra arguments may be passed here that will also be provided to the callback when invoked.
at line line 246
$this|mixed
options(string $page)
An OPTIONS
request
at line line 261
$this|mixed
patch(string $page, array|string $data = array(), array $files = array())
A PATCH
request
at line line 276
$this|mixed
post(string $page, array|string $data = array(), array $files = array())
A POST
request
at line line 291
$this|mixed
put(string $page, array|string $data = array(), array $files = array())
A PUT
request
at line line 304
$this
resetHandlersAfterRequest($reset)
Set the resetHandlers
property
at line line 318
$this
saveCall($cliCall)
Save the cliCall
into the provided variable
at line line 330
$this
saveRawResponse($rawResponse)
Save the raw response into the provided variable
at line line 344
$this
saveResponseCode($code)
Save the Http code into the provided variable
at line line 358
$this
saveResponseHandler(ResponseHandler $responseHandler)
Save the response handler into the provided variable
at line line 371
$this
saveResponseHeaders($responseHeaders)
Save the response headers into the provided variable
at line line 387
$this
setDestination($destination)
Set the destination
at line line 410
$this
setHeaders(array $headers)
Set the Http headers for the request
at line line 422
$this
setMultipart(bool $multipart = true)
Set whether POST data
is multipart/form-data
at line line 436
$this
setResponseHandler(null|string|ResponseHandler $responseHandler = null)
Set the response handler
at line line 460
$this
setUserAgent($userAgent)
Set the user agent string for all requests
at line line 476
$this|mixed
trace(string $page, array|string $data = array(), array $files = array())
A TRACE
request