src/Http/CurlHandler.php
protected function execute(array $options = [])
    {
        $session = $this->createSession();
        $result = [];

        try {
            if ($session->open() === false) {
                throw new RuntimeException('Cannot initialize a cURL session');
            }

            $session->setOptions($options + $this->options);

            $result = $session->execute();

            if ($result === false) {
                throw new TransferException($session->getErrorMessage(), $session->getErrorCode());
            }

            $headerSize = $session->getInfo(CURLINFO_HEADER_SIZE);

            if (strlen($result) < $headerSize) {
                throw new TransferException(
                    'Header size(' . $headerSize . ') does not match result: ' . $result
                );
            }

            $result = [
                substr($result, $headerSize) ?: null,
                substr($result, 0, $headerSize) ?: null,
            ];
        } finally {
            $session->close();
        }

        return $result;
    }
protected function execute(array $options = [])
    {
        $session = $this->createSession();
        $result = [];

        try {
            if ($session->open() === false) {
                throw new RuntimeException('Cannot initialize a cURL session');
            }

            $session->setOptions($options + $this->options);

            $result = $session->execute();

            if ($result === false) {
                throw new TransferException($session->getErrorMessage(), $session->getErrorCode());
            }

            $headerSize = $session->getInfo(CURLINFO_HEADER_SIZE);

            if (strlen($result) < $headerSize) {
                throw new TransferException(
                    'Header size(' . $headerSize . ') does not match result: ' . $result
                );
            }

            $result = [
                substr($result, $headerSize) ?: null,
                substr($result, 0, $headerSize) ?: null,
            ];
        } finally {
            $session->close();
        }

        return $result;
    }
protected function execute ( array $ options = [ ] ) { $ session = $ this -> createSession ( ) ; $ result = [ ] ; try { if ( $ session -> open ( ) === false ) { throw new RuntimeException ( 'Cannot initialize a cURL session' ) ; } $ session -> setOptions ( $ options + $ this -> options ) ; $ result = $ session -> execute ( ) ; if ( $ result === false ) { throw new TransferException ( $ session -> getErrorMessage ( ) , $ session -> getErrorCode ( ) ) ; } $ headerSize = $ session -> getInfo ( CURLINFO_HEADER_SIZE ) ; if ( strlen ( $ result ) < $ headerSize ) { throw new TransferException ( 'Header size(' . $ headerSize . ') does not match result: ' . $ result ) ; } $ result = [ substr ( $ result , $ headerSize ) ? : null , substr ( $ result , 0 , $ headerSize ) ? : null , ] ; } finally { $ session -> close ( ) ; } return $ result ; }
Execute cURL session.

@param array $options

@throws RuntimeException
@throws TransferException

@return array
Execute cURL session .