src/curl/Response.php
protected function parseRawResponse($data, $info)
    {
        $result = [];

        $headerSize = $info['header_size'];
        $result['data'] = substr($data, $headerSize);

        $rawHeaders = explode("\r\n", substr($data, 0, $headerSize));
        // First line is status-code HTTP/1.1 200 OK
        list(, $result['statusCode'], $result['reasonPhrase']) = explode(' ', array_shift($rawHeaders), 3);
        foreach ($rawHeaders as $line) {
            if ($line === '') {
                continue;
            }

            list($key, $value) = explode(': ', $line);
            $result['headers'][strtolower($key)][] = $value;
        }

        return $result;
    }
protected function parseRawResponse($data, $info)
    {
        $result = [];

        $headerSize = $info['header_size'];
        $result['data'] = substr($data, $headerSize);

        $rawHeaders = explode("\r\n", substr($data, 0, $headerSize));
        // First line is status-code HTTP/1.1 200 OK
        list(, $result['statusCode'], $result['reasonPhrase']) = explode(' ', array_shift($rawHeaders), 3);
        foreach ($rawHeaders as $line) {
            if ($line === '') {
                continue;
            }

            list($key, $value) = explode(': ', $line);
            $result['headers'][strtolower($key)][] = $value;
        }

        return $result;
    }
protected function parseRawResponse ( $ data , $ info ) { $ result = [ ] ; $ headerSize = $ info [ 'header_size' ] ; $ result [ 'data' ] = substr ( $ data , $ headerSize ) ; $ rawHeaders = explode ( "\r\n" , substr ( $ data , 0 , $ headerSize ) ) ; // First line is status-code HTTP/1.1 200 OK list ( , $ result [ 'statusCode' ] , $ result [ 'reasonPhrase' ] ) = explode ( ' ' , array_shift ( $ rawHeaders ) , 3 ) ; foreach ( $ rawHeaders as $ line ) { if ( $ line === '' ) { continue ; } list ( $ key , $ value ) = explode ( ': ' , $ line ) ; $ result [ 'headers' ] [ strtolower ( $ key ) ] [ ] = $ value ; } return $ result ; }
Parses raw response and returns parsed information.

@param string $data the raw response
@param array $info the curl information (result of `gurl_getinfo` call)
@return array array with the following keys will be returned:
- data: string, response data;
- headers: array, response headers;
- statusCode: string, the response status-code;
- reasonPhrase: string, the response reason phrase (OK, NOT FOUND, etc)
Parses raw response and returns parsed information .