Client

Implements \Http\Message\RequestFactory

Клиент для запросов

package

Dumkaaa\Boxberry\Api\Common\Http

Methods

__construct

__construct(null $httpClient = null, \Http\Message\RequestFactory|null $requestFactory = null) 

Arguments

$httpClient

null

$requestFactory

\Http\Message\RequestFactory|null

createRequest

createRequest( $method,  $uri, array $headers = array(), string|resource|\Psr\Http\Message\StreamInterface|null $body = null, string $protocolVersion = '1.1') : \Psr\Http\Message\RequestInterface

Arguments

$method

$uri

$headers

array

$body

string|resource|\Psr\Http\Message\StreamInterface|null

$protocolVersion

string

Response

\Psr\Http\Message\RequestInterface

Отправка GET-запроса

get(\Psr\Http\Message\UriInterface|string $uri, array $headers = array()) : \Psr\Http\Message\ResponseInterface

Arguments

$uri

\Psr\Http\Message\UriInterface|string

$headers

array

Response

\Psr\Http\Message\ResponseInterface

Отправка POST-запроса

post(\Psr\Http\Message\UriInterface|string $uri, array $headers = array(), string|array|null|resource|\Psr\Http\Message\StreamInterface $body = null) : \Psr\Http\Message\ResponseInterface

Arguments

$uri

\Psr\Http\Message\UriInterface|string

$headers

array

$body

string|array|null|resource|\Psr\Http\Message\StreamInterface

Response

\Psr\Http\Message\ResponseInterface

Отправка запроса

send( $method,  $uri, array $headers = array(), string|array|resource|\Psr\Http\Message\StreamInterface|null $body = null, string $protocolVersion = '1.1') : \Psr\Http\Message\ResponseInterface

Arguments

$method

$uri

$headers

array

$body

string|array|resource|\Psr\Http\Message\StreamInterface|null

$protocolVersion

string

Response

\Psr\Http\Message\ResponseInterface

sendRequest

sendRequest(\Psr\Http\Message\RequestInterface $request) : \Psr\Http\Message\ResponseInterface
Throws
\Http\Client\Exception

Arguments

$request

\Psr\Http\Message\RequestInterface

Response

\Psr\Http\Message\ResponseInterface

Properties

PSR-7 HttpClient, реализующий `public function sendRequest(RequestInterface $request)`

httpClient : \Http\Client\HttpClient
var

Type(s)

\Http\Client\HttpClient

PSR-7 RequestFactory

requestFactory : \Http\Message\RequestFactory
var

Type(s)

\Http\Message\RequestFactory