CHttpGet.php
public function parseHeader()
    {
        //$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
        
        $rawHeaders = rtrim($this->response['headerRaw'], "\r\n");
        # Handle multiple responses e.g. with redirections (proxies too)
        $headerGroups = explode("\r\n\r\n", $rawHeaders);
        # We're only interested in the last one
        $header = explode("\r\n", end($headerGroups));

        $output = array();

        if ('HTTP' === substr($header[0], 0, 4)) {
            list($output['version'], $output['status']) = explode(' ', $header[0]);
            unset($header[0]);
        }

        foreach ($header as $entry) {
            $pos = strpos($entry, ':');
            $output[trim(substr($entry, 0, $pos))] = trim(substr($entry, $pos + 1));
        }

        $this->response['header'] = $output;
        return $this;
    }
public function parseHeader()
    {
        //$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n"));
        
        $rawHeaders = rtrim($this->response['headerRaw'], "\r\n");
        # Handle multiple responses e.g. with redirections (proxies too)
        $headerGroups = explode("\r\n\r\n", $rawHeaders);
        # We're only interested in the last one
        $header = explode("\r\n", end($headerGroups));

        $output = array();

        if ('HTTP' === substr($header[0], 0, 4)) {
            list($output['version'], $output['status']) = explode(' ', $header[0]);
            unset($header[0]);
        }

        foreach ($header as $entry) {
            $pos = strpos($entry, ':');
            $output[trim(substr($entry, 0, $pos))] = trim(substr($entry, $pos + 1));
        }

        $this->response['header'] = $output;
        return $this;
    }
public function parseHeader ( ) { //$header = explode("\r\n", rtrim($this->response['headerRaw'], "\r\n")); $ rawHeaders = rtrim ( $ this -> response [ 'headerRaw' ] , "\r\n" ) ; # Handle multiple responses e.g. with redirections (proxies too) $ headerGroups = explode ( "\r\n\r\n" , $ rawHeaders ) ; # We're only interested in the last one $ header = explode ( "\r\n" , end ( $ headerGroups ) ) ; $ output = array ( ) ; if ( 'HTTP' === substr ( $ header [ 0 ] , 0 , 4 ) ) { list ( $ output [ 'version' ] , $ output [ 'status' ] ) = explode ( ' ' , $ header [ 0 ] ) ; unset ( $ header [ 0 ] ) ; } foreach ( $ header as $ entry ) { $ pos = strpos ( $ entry , ':' ) ; $ output [ trim ( substr ( $ entry , 0 , $ pos ) ) ] = trim ( substr ( $ entry , $ pos + 1 ) ) ; } $ this -> response [ 'header' ] = $ output ; return $ this ; }
Set header fields for the request.

@param string $field
@param string $value

@return $this
Set header fields for the request .