public function sendAsyncRequest(RequestInterface $request)
    {
        if (!$this->multiRunner instanceof MultiRunner) {
            $this->multiRunner = new MultiRunner();
        }

        $handle = curl_init();
        $responseBuilder = $this->createResponseBuilder();
        $requestOptions = $this->prepareRequestOptions($request, $responseBuilder);
        curl_setopt_array($handle, $requestOptions);

        $core = new PromiseCore($request, $handle, $responseBuilder);
        $promise = new CurlPromise($core, $this->multiRunner);
        $this->multiRunner->add($core);

        return $promise;
    }
public function sendAsyncRequest(RequestInterface $request)
    {
        if (!$this->multiRunner instanceof MultiRunner) {
            $this->multiRunner = new MultiRunner();
        }

        $handle = curl_init();
        $responseBuilder = $this->createResponseBuilder();
        $requestOptions = $this->prepareRequestOptions($request, $responseBuilder);
        curl_setopt_array($handle, $requestOptions);

        $core = new PromiseCore($request, $handle, $responseBuilder);
        $promise = new CurlPromise($core, $this->multiRunner);
        $this->multiRunner->add($core);

        return $promise;
    }
public function sendAsyncRequest ( RequestInterface $ request ) { if ( ! $ this -> multiRunner instanceof MultiRunner ) { $ this -> multiRunner = new MultiRunner ( ) ; } $ handle = curl_init ( ) ; $ responseBuilder = $ this -> createResponseBuilder ( ) ; $ requestOptions = $ this -> prepareRequestOptions ( $ request , $ responseBuilder ) ; curl_setopt_array ( $ handle , $ requestOptions ) ; $ core = new PromiseCore ( $ request , $ handle , $ responseBuilder ) ; $ promise = new CurlPromise ( $ core , $ this -> multiRunner ) ; $ this -> multiRunner -> add ( $ core ) ; return $ promise ; }
Sends a PSR-7 request in an asynchronous way.

Exceptions related to processing the request are available from the returned Promise.

@param RequestInterface $request

@return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception.

@throws \InvalidArgumentException  For invalid header names or values.
@throws \RuntimeException          If creating the body stream fails.
@throws Exception\RequestException On invalid request.

@since 1.6 \UnexpectedValueException replaced with RequestException
@since 1.0
Sends a PSR - 7 request in an asynchronous way .