function drupal_get_http_header

drupal_get_http_header($name = NULL)

Gets the HTTP response headers for the current page.

Parameters

$name: An HTTP header name. If omitted, all headers are returned as name/value pairs. If an array value is FALSE, the header has been unset.

Return value

A string containing the header value, or FALSE if the header has been set, or NULL if the header has not been set.

File

includes/bootstrap.inc, line 1415
Functions that need to be loaded on every Drupal request.

Code

function drupal_get_http_header($name = NULL) {
  $headers = &drupal_static('drupal_http_headers', array());
  if (isset($name)) {
    $name = strtolower($name);
    return isset($headers[$name]) ? $headers[$name] : NULL;
  }
  else {
    return $headers;
  }
}

© 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!bootstrap.inc/function/drupal_get_http_header/7.x