src/Http/Client/AbstractCurl.php
protected function prepare($curl, RequestInterface $request, array $options): ResponseInterface
    {
        if (\defined('CURLOPT_PROTOCOLS')) {
            \curl_setopt($curl, \CURLOPT_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS);
            \curl_setopt($curl, \CURLOPT_REDIR_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS);
        }

        \curl_setopt($curl, \CURLOPT_HEADER, false);
        \curl_setopt($curl, \CURLOPT_RETURNTRANSFER, false);
        \curl_setopt($curl, \CURLOPT_FAILONERROR, false);

        $this->setOptionsFromParameter($curl, $options);
        $this->setOptionsFromRequest($curl, $request);

        $response = Factory::response();
        \curl_setopt($curl, \CURLOPT_HEADERFUNCTION, function ($ch, $data) use ($response) {
            $str = \trim($data);
            if ('' !== $str) {
                if (0 === \stripos($str, 'http/')) {
                    $this->setStatus($response, $str);
                } else {
                    $this->addHeader($response, $str);
                }
            }

            return \strlen($data);
        });

        \curl_setopt($curl, \CURLOPT_WRITEFUNCTION, function ($ch, $data) use ($response) {
            return $response->getBody()->write($data);
        });

        // apply additional options
        if ($options['curl'] !== []) {
            \curl_setopt_array($curl, $options['curl']);
        }

        return $response;
    }
protected function prepare($curl, RequestInterface $request, array $options): ResponseInterface
    {
        if (\defined('CURLOPT_PROTOCOLS')) {
            \curl_setopt($curl, \CURLOPT_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS);
            \curl_setopt($curl, \CURLOPT_REDIR_PROTOCOLS, \CURLPROTO_HTTP | \CURLPROTO_HTTPS);
        }

        \curl_setopt($curl, \CURLOPT_HEADER, false);
        \curl_setopt($curl, \CURLOPT_RETURNTRANSFER, false);
        \curl_setopt($curl, \CURLOPT_FAILONERROR, false);

        $this->setOptionsFromParameter($curl, $options);
        $this->setOptionsFromRequest($curl, $request);

        $response = Factory::response();
        \curl_setopt($curl, \CURLOPT_HEADERFUNCTION, function ($ch, $data) use ($response) {
            $str = \trim($data);
            if ('' !== $str) {
                if (0 === \stripos($str, 'http/')) {
                    $this->setStatus($response, $str);
                } else {
                    $this->addHeader($response, $str);
                }
            }

            return \strlen($data);
        });

        \curl_setopt($curl, \CURLOPT_WRITEFUNCTION, function ($ch, $data) use ($response) {
            return $response->getBody()->write($data);
        });

        // apply additional options
        if ($options['curl'] !== []) {
            \curl_setopt_array($curl, $options['curl']);
        }

        return $response;
    }
protected function prepare ( $ curl , RequestInterface $ request , array $ options ) : ResponseInterface { if ( \ defined ( 'CURLOPT_PROTOCOLS' ) ) { \ curl_setopt ( $ curl , \ CURLOPT_PROTOCOLS , \ CURLPROTO_HTTP | \ CURLPROTO_HTTPS ) ; \ curl_setopt ( $ curl , \ CURLOPT_REDIR_PROTOCOLS , \ CURLPROTO_HTTP | \ CURLPROTO_HTTPS ) ; } \ curl_setopt ( $ curl , \ CURLOPT_HEADER , false ) ; \ curl_setopt ( $ curl , \ CURLOPT_RETURNTRANSFER , false ) ; \ curl_setopt ( $ curl , \ CURLOPT_FAILONERROR , false ) ; $ this -> setOptionsFromParameter ( $ curl , $ options ) ; $ this -> setOptionsFromRequest ( $ curl , $ request ) ; $ response = Factory :: response ( ) ; \ curl_setopt ( $ curl , \ CURLOPT_HEADERFUNCTION , function ( $ ch , $ data ) use ( $ response ) { $ str = \ trim ( $ data ) ; if ( '' !== $ str ) { if ( 0 === \ stripos ( $ str , 'http/' ) ) { $ this -> setStatus ( $ response , $ str ) ; } else { $ this -> addHeader ( $ response , $ str ) ; } } return \ strlen ( $ data ) ; } ) ; \ curl_setopt ( $ curl , \ CURLOPT_WRITEFUNCTION , function ( $ ch , $ data ) use ( $ response ) { return $ response -> getBody ( ) -> write ( $ data ) ; } ) ; // apply additional options
 if ( $ options [ 'curl' ] !== [ ] ) { \ curl_setopt_array ( $ curl , $ options [ 'curl' ] ) ; } return $ response ; }
Prepares a cURL resource to send a request.

@param resource         $curl
@param RequestInterface $request
@param array            $options

@return ResponseInterface
Prepares a cURL resource to send a request .