IClient
in
Interface IClient
Tags
Table of Contents
Constants
- DEFAULT_REQUEST_TIMEOUT = 30
- Default request timeout for requests
Methods
- delete() : IResponse
- Sends a DELETE request
- deleteAsync() : IPromise
- Sends an asynchronous DELETE request
- get() : IResponse
- Sends a GET request
- getAsync() : IPromise
- Sends an asynchronous GET request
- getResponseFromThrowable() : IResponse
- Get the response of a Throwable thrown by the request methods when possible
- head() : IResponse
- Sends a HEAD request
- headAsync() : IPromise
- Sends an asynchronous HEAD request
- options() : IResponse
- Sends an OPTIONS request
- optionsAsync() : IPromise
- Sends an asynchronous OPTIONS request
- patch() : IResponse
- Sends a PATCH request
- post() : IResponse
- Sends a POST request
- postAsync() : IPromise
- Sends an asynchronous POST request
- put() : IResponse
- Sends a PUT request
- putAsync() : IPromise
- Sends an asynchronous PUT request
- request() : IResponse
- Sends a HTTP request
Constants
DEFAULT_REQUEST_TIMEOUT
Default request timeout for requests
public
mixed
DEFAULT_REQUEST_TIMEOUT
= 30
Tags
Methods
delete()
Sends a DELETE request
public
delete(string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IResponsedeleteAsync()
Sends an asynchronous DELETE request
public
deleteAsync(string $uri[, array<string|int, mixed> $options = [] ]) : IPromise
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IPromiseget()
Sends a GET request
public
get(string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'query' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IResponsegetAsync()
Sends an asynchronous GET request
public
getAsync(string $uri[, array<string|int, mixed> $options = [] ]) : IPromise
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'query' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IPromisegetResponseFromThrowable()
Get the response of a Throwable thrown by the request methods when possible
public
getResponseFromThrowable(Throwable $e) : IResponse
Parameters
- $e : Throwable
Tags
Return values
IResponsehead()
Sends a HEAD request
public
head(string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IResponseheadAsync()
Sends an asynchronous HEAD request
public
headAsync(string $uri[, array<string|int, mixed> $options = [] ]) : IPromise
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IPromiseoptions()
Sends an OPTIONS request
public
options(string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IResponseoptionsAsync()
Sends an asynchronous OPTIONS request
public
optionsAsync(string $uri[, array<string|int, mixed> $options = [] ]) : IPromise
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IPromisepatch()
Sends a PATCH request
public
patch(string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IResponsepost()
Sends a POST request
public
post(string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IResponsepostAsync()
Sends an asynchronous POST request
public
postAsync(string $uri[, array<string|int, mixed> $options = [] ]) : IPromise
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IPromiseput()
Sends a PUT request
public
put(string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IResponseputAsync()
Sends an asynchronous PUT request
public
putAsync(string $uri[, array<string|int, mixed> $options = [] ]) : IPromise
Parameters
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'body' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,
Tags
Return values
IPromiserequest()
Sends a HTTP request
public
request(string $method, string $uri[, array<string|int, mixed> $options = [] ]) : IResponse
Parameters
- $method : string
-
The HTTP method to use
- $uri : string
- $options : array<string|int, mixed> = []
-
Array such as 'query' => [ 'field' => 'abc', 'other_field' => '123', 'file_name' => fopen('/path/to/file', 'r'), ], 'headers' => [ 'foo' => 'bar', ], 'cookies' => [ 'foo' => 'bar', ], 'allow_redirects' => [ 'max' => 10, // allow at most 10 redirects. 'strict' => true, // use "strict" RFC compliant redirects. 'referer' => true, // add a Referer header 'protocols' => ['https'] // only allow https URLs ], 'sink' => '/path/to/file', // save to a file or a stream 'verify' => true, // bool or string to CA file 'debug' => true,