On this page
function _drupal_parse_response_status
_drupal_parse_response_status($response)
Splits an HTTP response status line into components.
See the status line definition in RFC 2616.
Parameters
string $respone: The response status line, for example 'HTTP/1.1 500 Internal Server Error'.
Return value
array Keyed array containing the component parts. If the response is malformed, all possible parts will be extracted. 'reason_phrase' could be empty. Possible keys:
- 'http_version'
- 'response_code'
- 'reason_phrase'
Related topics
File
- includes/common.inc, line 1121
- Common functions that many Drupal modules will need to reference.
Code
function _drupal_parse_response_status($response) {
$response_array = explode(' ', trim($response), 3);
// Set up empty values.
$result = array(
'reason_phrase' => '',
);
$result['http_version'] = $response_array[0];
$result['response_code'] = $response_array[1];
if (isset($response_array[2])) {
$result['reason_phrase'] = $response_array[2];
}
return $result;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/_drupal_parse_response_status/7.x