protected function doExecute(&$curlHandle) {
        $this->setCurlOpts($curlHandle);
        $response = \curl_exec($curlHandle);

        $header_size = \curl_getinfo($curlHandle, CURLINFO_HEADER_SIZE);

        $this->response_body = substr($response, $header_size);

        $this->response_headers = [];

        $lines = explode("\r\n", substr($response, 0, $header_size));
        foreach ($lines as $i => $line) {
            if ($i === 0) {
                $this->response_headers['http_code'] = $line;
                $piece = explode(" ", $line);
                if (count($piece) > 1) {
                    $this->response_headers['protocol'] = $piece[0];
                    $this->response_headers['status_code'] = $piece[1];
                    array_splice($piece, 0, 2); //Remove protocol and code
                    $this->response_headers['reason_phrase'] = implode(" ", $piece);
                }
            } else {
                $piece = explode(': ', $line, 2);
                if (count($piece) == 2) {
                    list ($key, $value) = $piece;

                    if (trim($key) !== "") {
                        $this->response_headers[$key] = trim($value);
                    }
                }
            }
        }
        $this->response_info = \curl_getinfo($curlHandle);

        \curl_close($curlHandle);
    }
protected function doExecute(&$curlHandle) {
        $this->setCurlOpts($curlHandle);
        $response = \curl_exec($curlHandle);

        $header_size = \curl_getinfo($curlHandle, CURLINFO_HEADER_SIZE);

        $this->response_body = substr($response, $header_size);

        $this->response_headers = [];

        $lines = explode("\r\n", substr($response, 0, $header_size));
        foreach ($lines as $i => $line) {
            if ($i === 0) {
                $this->response_headers['http_code'] = $line;
                $piece = explode(" ", $line);
                if (count($piece) > 1) {
                    $this->response_headers['protocol'] = $piece[0];
                    $this->response_headers['status_code'] = $piece[1];
                    array_splice($piece, 0, 2); //Remove protocol and code
                    $this->response_headers['reason_phrase'] = implode(" ", $piece);
                }
            } else {
                $piece = explode(': ', $line, 2);
                if (count($piece) == 2) {
                    list ($key, $value) = $piece;

                    if (trim($key) !== "") {
                        $this->response_headers[$key] = trim($value);
                    }
                }
            }
        }
        $this->response_info = \curl_getinfo($curlHandle);

        \curl_close($curlHandle);
    }
protected function doExecute ( & $ curlHandle ) { $ this -> setCurlOpts ( $ curlHandle ) ; $ response = \ curl_exec ( $ curlHandle ) ; $ header_size = \ curl_getinfo ( $ curlHandle , CURLINFO_HEADER_SIZE ) ; $ this -> response_body = substr ( $ response , $ header_size ) ; $ this -> response_headers = [ ] ; $ lines = explode ( "\r\n" , substr ( $ response , 0 , $ header_size ) ) ; foreach ( $ lines as $ i => $ line ) { if ( $ i === 0 ) { $ this -> response_headers [ 'http_code' ] = $ line ; $ piece = explode ( " " , $ line ) ; if ( count ( $ piece ) > 1 ) { $ this -> response_headers [ 'protocol' ] = $ piece [ 0 ] ; $ this -> response_headers [ 'status_code' ] = $ piece [ 1 ] ; array_splice ( $ piece , 0 , 2 ) ; //Remove protocol and code $ this -> response_headers [ 'reason_phrase' ] = implode ( " " , $ piece ) ; } } else { $ piece = explode ( ': ' , $ line , 2 ) ; if ( count ( $ piece ) == 2 ) { list ( $ key , $ value ) = $ piece ; if ( trim ( $ key ) !== "" ) { $ this -> response_headers [ $ key ] = trim ( $ value ) ; } } } } $ this -> response_info = \ curl_getinfo ( $ curlHandle ) ; \ curl_close ( $ curlHandle ) ; }
Perform Curl REquest

@param object $curlHandle
Perform Curl REquest