Abstract Class yii\httpclient\Transport

Inheritanceyii\httpclient\Transport » yii\base\Component
Subclassesyii\httpclient\CurlTransport, yii\httpclient\MockTransport, yii\httpclient\StreamTransport
Available since extension's version2.0
Source Code https://github.com/yiisoft/yii2-httpclient/blob/master/src/Transport.php

Transport performs actual HTTP request sending.

Public Methods

Hide inherited methods

Method Description Defined By
batchSend() Performs multiple HTTP requests. yii\httpclient\Transport
send() Performs given request. yii\httpclient\Transport

Method Details

Hide inherited methods

batchSend() public method

Performs multiple HTTP requests.

Particular transport may benefit from this method, allowing sending requests in parallel. This method accepts an array of the yii\httpclient\Request objects and returns an array of the yii\httpclient\Response objects. Keys of the response array correspond the ones from request array.

public yii\httpclient\Response[] batchSend ( array $requests )
$requests yii\httpclient\Request[]

Requests to perform.

return yii\httpclient\Response[]

Responses list.

throws yii\httpclient\Exception

                public function batchSend(array $requests)
{
    $responses = [];
    foreach ($requests as $key => $request) {
        $responses[$key] = $this->send($request);
    }
    return $responses;
}

            
send() public abstract method

Performs given request.

public abstract yii\httpclient\Response send ( $request )
$request yii\httpclient\Request

Request to be sent.

return yii\httpclient\Response

Response instance.

throws yii\httpclient\Exception

on failure.

                abstract public function send($request);