interface HttpClientInterface (View source)

Interface HttpClientInterface

Methods

ResponseInterface
request(string $method, string|object $url, mixed $data = null, array $headers)

Request a remote server.

ResponseInterface
send(RequestInterface $request)

Send a request to remote.

Details

at line line 33
ResponseInterface request(string $method, string|object $url, mixed $data = null, array $headers)

Request a remote server.

This method will build a Request object and use send() method to send request.

Parameters

string $method The method type.
string|object $url The URL to request, may be string or Uri object.
mixed $data The request body data, can be an array of POST data.
array $headers The headers array.

Return Value

ResponseInterface

at line line 42
ResponseInterface send(RequestInterface $request)

Send a request to remote.

Parameters

RequestInterface $request The Psr Request object.

Return Value

ResponseInterface