public function parseRequest($message)
    {
        if (!($parts = $this->parseMessage($message))) {
            return false;
        }

        // Parse the protocol and protocol version
        if (isset($parts['start_line'][2])) {
            $startParts = explode('/', $parts['start_line'][2]);
            $protocol = strtoupper($startParts[0]);
            $version = isset($startParts[1]) ? $startParts[1] : '1.1';
        } else {
            $protocol = 'HTTP';
            $version = '1.1';
        }

        $parsed = [
            'method'   => strtoupper($parts['start_line'][0]),
            'protocol' => $protocol,
            'protocol_version' => $version,
            'headers'  => $parts['headers'],
            'body'     => $parts['body']
        ];

        $parsed['request_url'] = $this->getUrlPartsFromMessage(
            (isset($parts['start_line'][1]) ? $parts['start_line'][1] : ''), $parsed);

        return $parsed;
    }
public function parseRequest($message)
    {
        if (!($parts = $this->parseMessage($message))) {
            return false;
        }

        // Parse the protocol and protocol version
        if (isset($parts['start_line'][2])) {
            $startParts = explode('/', $parts['start_line'][2]);
            $protocol = strtoupper($startParts[0]);
            $version = isset($startParts[1]) ? $startParts[1] : '1.1';
        } else {
            $protocol = 'HTTP';
            $version = '1.1';
        }

        $parsed = [
            'method'   => strtoupper($parts['start_line'][0]),
            'protocol' => $protocol,
            'protocol_version' => $version,
            'headers'  => $parts['headers'],
            'body'     => $parts['body']
        ];

        $parsed['request_url'] = $this->getUrlPartsFromMessage(
            (isset($parts['start_line'][1]) ? $parts['start_line'][1] : ''), $parsed);

        return $parsed;
    }
public function parseRequest ( $ message ) { if ( ! ( $ parts = $ this -> parseMessage ( $ message ) ) ) { return false ; } // Parse the protocol and protocol version if ( isset ( $ parts [ 'start_line' ] [ 2 ] ) ) { $ startParts = explode ( '/' , $ parts [ 'start_line' ] [ 2 ] ) ; $ protocol = strtoupper ( $ startParts [ 0 ] ) ; $ version = isset ( $ startParts [ 1 ] ) ? $ startParts [ 1 ] : '1.1' ; } else { $ protocol = 'HTTP' ; $ version = '1.1' ; } $ parsed = [ 'method' => strtoupper ( $ parts [ 'start_line' ] [ 0 ] ) , 'protocol' => $ protocol , 'protocol_version' => $ version , 'headers' => $ parts [ 'headers' ] , 'body' => $ parts [ 'body' ] ] ; $ parsed [ 'request_url' ] = $ this -> getUrlPartsFromMessage ( ( isset ( $ parts [ 'start_line' ] [ 1 ] ) ? $ parts [ 'start_line' ] [ 1 ] : '' ) , $ parsed ) ; return $ parsed ; }
Parse an HTTP request message into an associative array of parts.

@param string $message HTTP request to parse

@return array|bool Returns false if the message is invalid
Parse an HTTP request message into an associative array of parts .