| Methods |
public
|
send(
RequestInterface $request,
array{base_uri?: (string|UriInterface), allow_redirects?: (bool|array{max?: int, strict?: bool, referer?: bool, protocols?: non-empty-array<array-key, string>, on_redirect?: (callable(RequestInterface, ResponseInterface, UriInterface): mixed), track_redirects?: bool}), auth?: (array{0: string, 1: string, 2?: (string|null)}|string|false|null), body?: (resource|string|null|StreamInterface|(callable&object)|Iterator|Stringable), cert?: (string|array{0: string, 1?: (string|null)}), cert_type?: string, connect_timeout?: (int|float), cookies?: (false|CookieJarInterface), crypto_method?: int, crypto_method_max?: int, debug?: (bool|resource), decode_content?: (bool|string), delay?: (int|float), expect?: (bool|int), form_params?: array<array-key, string|int|float|bool|null|array>, force_ip_resolve?: string, headers?: (array<array-key, string|non-empty-array<array-key, string>>|null), http_errors?: bool, idn_conversion?: (bool|int|null), json?: mixed, multipart?: array<array-key, array{name: (string|int), contents: mixed, headers?: array<array-key, string>, filename?: string}>, multiplex?: string, on_headers?: (callable(ResponseInterface, RequestInterface): mixed), on_stats?: (callable(TransferStats): mixed), on_trailers?: (callable(array<string, list<string>>, ResponseInterface, RequestInterface): mixed), progress?: (callable(int, int, int, int): mixed), protocols?: non-empty-array<array-key, string>, proxy?: (string|array{http?: (string|null), https?: (string|null), no?: (string|array<array-key, string>|null)}), query?: (array<array-key, mixed>|string), read_timeout?: (int|float), retries?: int, request_factory?: RequestFactoryInterface, response_factory?: ResponseFactoryInterface, sink?: (resource|string|StreamInterface), ssl_key?: (string|array{0: string, 1?: (string|null)}), ssl_key_type?: string, stream?: bool, stream_factory?: StreamFactoryInterface, stream_context?: array<array-key, mixed>, synchronous?: bool, timeout?: (int|float), uri_factory?: UriFactoryInterface, verify?: (bool|string), version?: (string|int|float), curl?: array<int|string, mixed>, ...} $options = [],
): ResponseInterface
Send an HTTP request.
Parameters
| $request |
Request to send
|
| $options |
Request options to apply to the given request and to the transfer.
|
Throws
|
#
|
public
|
sendAsync(
RequestInterface $request,
array{base_uri?: (string|UriInterface), allow_redirects?: (bool|array{max?: int, strict?: bool, referer?: bool, protocols?: non-empty-array<array-key, string>, on_redirect?: (callable(RequestInterface, ResponseInterface, UriInterface): mixed), track_redirects?: bool}), auth?: (array{0: string, 1: string, 2?: (string|null)}|string|false|null), body?: (resource|string|null|StreamInterface|(callable&object)|Iterator|Stringable), cert?: (string|array{0: string, 1?: (string|null)}), cert_type?: string, connect_timeout?: (int|float), cookies?: (false|CookieJarInterface), crypto_method?: int, crypto_method_max?: int, debug?: (bool|resource), decode_content?: (bool|string), delay?: (int|float), expect?: (bool|int), form_params?: array<array-key, string|int|float|bool|null|array>, force_ip_resolve?: string, headers?: (array<array-key, string|non-empty-array<array-key, string>>|null), http_errors?: bool, idn_conversion?: (bool|int|null), json?: mixed, multipart?: array<array-key, array{name: (string|int), contents: mixed, headers?: array<array-key, string>, filename?: string}>, multiplex?: string, on_headers?: (callable(ResponseInterface, RequestInterface): mixed), on_stats?: (callable(TransferStats): mixed), on_trailers?: (callable(array<string, list<string>>, ResponseInterface, RequestInterface): mixed), progress?: (callable(int, int, int, int): mixed), protocols?: non-empty-array<array-key, string>, proxy?: (string|array{http?: (string|null), https?: (string|null), no?: (string|array<array-key, string>|null)}), query?: (array<array-key, mixed>|string), read_timeout?: (int|float), retries?: int, request_factory?: RequestFactoryInterface, response_factory?: ResponseFactoryInterface, sink?: (resource|string|StreamInterface), ssl_key?: (string|array{0: string, 1?: (string|null)}), ssl_key_type?: string, stream?: bool, stream_factory?: StreamFactoryInterface, stream_context?: array<array-key, mixed>, synchronous?: bool, timeout?: (int|float), uri_factory?: UriFactoryInterface, verify?: (bool|string), version?: (string|int|float), curl?: array<int|string, mixed>, ...} $options = [],
): PromiseInterface<ResponseInterface, mixed>
Asynchronously send an HTTP request.
Asynchronously send an HTTP request.
Parameters
| $request |
Request to send
|
| $options |
Request options to apply to the given request and to the transfer.
|
|
#
|
public
|
request(
string $method,
string|UriInterface $uri,
array{base_uri?: (string|UriInterface), allow_redirects?: (bool|array{max?: int, strict?: bool, referer?: bool, protocols?: non-empty-array<array-key, string>, on_redirect?: (callable(RequestInterface, ResponseInterface, UriInterface): mixed), track_redirects?: bool}), auth?: (array{0: string, 1: string, 2?: (string|null)}|string|false|null), body?: (resource|string|null|StreamInterface|(callable&object)|Iterator|Stringable), cert?: (string|array{0: string, 1?: (string|null)}), cert_type?: string, connect_timeout?: (int|float), cookies?: (false|CookieJarInterface), crypto_method?: int, crypto_method_max?: int, debug?: (bool|resource), decode_content?: (bool|string), delay?: (int|float), expect?: (bool|int), form_params?: array<array-key, string|int|float|bool|null|array>, force_ip_resolve?: string, headers?: (array<array-key, string|non-empty-array<array-key, string>>|null), http_errors?: bool, idn_conversion?: (bool|int|null), json?: mixed, multipart?: array<array-key, array{name: (string|int), contents: mixed, headers?: array<array-key, string>, filename?: string}>, multiplex?: string, on_headers?: (callable(ResponseInterface, RequestInterface): mixed), on_stats?: (callable(TransferStats): mixed), on_trailers?: (callable(array<string, list<string>>, ResponseInterface, RequestInterface): mixed), progress?: (callable(int, int, int, int): mixed), protocols?: non-empty-array<array-key, string>, proxy?: (string|array{http?: (string|null), https?: (string|null), no?: (string|array<array-key, string>|null)}), query?: (array<array-key, mixed>|string), read_timeout?: (int|float), retries?: int, request_factory?: RequestFactoryInterface, response_factory?: ResponseFactoryInterface, sink?: (resource|string|StreamInterface), ssl_key?: (string|array{0: string, 1?: (string|null)}), ssl_key_type?: string, stream?: bool, stream_factory?: StreamFactoryInterface, stream_context?: array<array-key, mixed>, synchronous?: bool, timeout?: (int|float), uri_factory?: UriFactoryInterface, verify?: (bool|string), version?: (string|int|float), curl?: array<int|string, mixed>, ...} $options = [],
): ResponseInterface
Create and send an HTTP request.
Create and send an HTTP request.
Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.
Parameters
| $method |
HTTP method.
|
| $uri |
URI object or string.
|
| $options |
Request options to apply.
|
Throws
|
#
|
public
|
requestAsync(
string $method,
string|UriInterface $uri,
array{base_uri?: (string|UriInterface), allow_redirects?: (bool|array{max?: int, strict?: bool, referer?: bool, protocols?: non-empty-array<array-key, string>, on_redirect?: (callable(RequestInterface, ResponseInterface, UriInterface): mixed), track_redirects?: bool}), auth?: (array{0: string, 1: string, 2?: (string|null)}|string|false|null), body?: (resource|string|null|StreamInterface|(callable&object)|Iterator|Stringable), cert?: (string|array{0: string, 1?: (string|null)}), cert_type?: string, connect_timeout?: (int|float), cookies?: (false|CookieJarInterface), crypto_method?: int, crypto_method_max?: int, debug?: (bool|resource), decode_content?: (bool|string), delay?: (int|float), expect?: (bool|int), form_params?: array<array-key, string|int|float|bool|null|array>, force_ip_resolve?: string, headers?: (array<array-key, string|non-empty-array<array-key, string>>|null), http_errors?: bool, idn_conversion?: (bool|int|null), json?: mixed, multipart?: array<array-key, array{name: (string|int), contents: mixed, headers?: array<array-key, string>, filename?: string}>, multiplex?: string, on_headers?: (callable(ResponseInterface, RequestInterface): mixed), on_stats?: (callable(TransferStats): mixed), on_trailers?: (callable(array<string, list<string>>, ResponseInterface, RequestInterface): mixed), progress?: (callable(int, int, int, int): mixed), protocols?: non-empty-array<array-key, string>, proxy?: (string|array{http?: (string|null), https?: (string|null), no?: (string|array<array-key, string>|null)}), query?: (array<array-key, mixed>|string), read_timeout?: (int|float), retries?: int, request_factory?: RequestFactoryInterface, response_factory?: ResponseFactoryInterface, sink?: (resource|string|StreamInterface), ssl_key?: (string|array{0: string, 1?: (string|null)}), ssl_key_type?: string, stream?: bool, stream_factory?: StreamFactoryInterface, stream_context?: array<array-key, mixed>, synchronous?: bool, timeout?: (int|float), uri_factory?: UriFactoryInterface, verify?: (bool|string), version?: (string|int|float), curl?: array<int|string, mixed>, ...} $options = [],
): PromiseInterface<ResponseInterface, mixed>
Create and send an asynchronous HTTP request.
Create and send an asynchronous HTTP request.
Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.
Parameters
| $method |
HTTP method
|
| $uri |
URI object or string.
|
| $options |
Request options to apply.
|
|
#
|