final protected function parseIncomingRaw($header)
    {
        $retval = array();
        $content = "";
        $fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header));
        foreach ($fields as $field) {
            if (preg_match('/([^:]+): (.+)/m', $field, $match)) {
                $match[1] = preg_replace_callback('/(?<=^|[\x09\x20\x2D])./', function ($matches) {
                    return strtoupper($matches[0]);
                }, strtolower(trim($match[1])));
                if (isset($retval[$match[1]])) {
                    $retval[$match[1]] = array($retval[$match[1]], $match[2]);
                } else {
                    $retval[$match[1]] = trim($match[2]);
                }
            } else if (preg_match('!HTTP/1\.\d (\d)* .!', $field)) {
                $retval["status"] = $field;
            } else {
                $content .= $field . "\r\n";
            }
        }
        $retval['content'] = $content;

        return $retval;
    }
final protected function parseIncomingRaw($header)
    {
        $retval = array();
        $content = "";
        $fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $header));
        foreach ($fields as $field) {
            if (preg_match('/([^:]+): (.+)/m', $field, $match)) {
                $match[1] = preg_replace_callback('/(?<=^|[\x09\x20\x2D])./', function ($matches) {
                    return strtoupper($matches[0]);
                }, strtolower(trim($match[1])));
                if (isset($retval[$match[1]])) {
                    $retval[$match[1]] = array($retval[$match[1]], $match[2]);
                } else {
                    $retval[$match[1]] = trim($match[2]);
                }
            } else if (preg_match('!HTTP/1\.\d (\d)* .!', $field)) {
                $retval["status"] = $field;
            } else {
                $content .= $field . "\r\n";
            }
        }
        $retval['content'] = $content;

        return $retval;
    }
final protected function parseIncomingRaw ( $ header ) { $ retval = array ( ) ; $ content = "" ; $ fields = explode ( "\r\n" , preg_replace ( '/\x0D\x0A[\x09\x20]+/' , ' ' , $ header ) ) ; foreach ( $ fields as $ field ) { if ( preg_match ( '/([^:]+): (.+)/m' , $ field , $ match ) ) { $ match [ 1 ] = preg_replace_callback ( '/(?<=^|[\x09\x20\x2D])./' , function ( $ matches ) { return strtoupper ( $ matches [ 0 ] ) ; } , strtolower ( trim ( $ match [ 1 ] ) ) ) ; if ( isset ( $ retval [ $ match [ 1 ] ] ) ) { $ retval [ $ match [ 1 ] ] = array ( $ retval [ $ match [ 1 ] ] , $ match [ 2 ] ) ; } else { $ retval [ $ match [ 1 ] ] = trim ( $ match [ 2 ] ) ; } } else if ( preg_match ( '!HTTP/1\.\d (\d)* .!' , $ field ) ) { $ retval [ "status" ] = $ field ; } else { $ content .= $ field . "\r\n" ; } } $ retval [ 'content' ] = $ content ; return $ retval ; }
Parse raw incoming data

@param $header
@return array
Parse raw incoming data