public function MessageParser::parseResponse

Parse an HTTP response message into an associative array of parts.

Parameters

string $message HTTP response to parse:

Return value

array|bool Returns false if the message is invalid

Overrides MessageParserInterface::parseResponse

File

drupal/core/vendor/guzzle/parser/Guzzle/Parser/Message/MessageParser.php, line 47

Class

MessageParser
Default request and response parser used by Guzzle. Optimized for speed.

Namespace

Guzzle\Parser\Message

Code

public function parseResponse($message) {
  if (!$message) {
    return false;
  }
  $parts = $this
    ->parseMessage($message);
  list($protocol, $version) = explode('/', trim($parts['start_line'][0]));
  return array(
    'protocol' => $protocol,
    'version' => $version,
    'code' => $parts['start_line'][1],
    'reason_phrase' => isset($parts['start_line'][2]) ? $parts['start_line'][2] : '',
    'headers' => $parts['headers'],
    'body' => $parts['body'],
  );
}