Open GoogleCodeExporter opened 8 years ago
Here is an alternate way to retrieve those headers, as suggested by tehjosh who
left
this comment in the PHP documentation
(http://ca2.php.net/manual/en/function.apache-request-headers.php#73964):
<?php
function request_headers()
{
if(function_exists("apache_request_headers")) // If apache_request_headers()
exists...
{
if($headers = apache_request_headers()) // And works...
{
return $headers; // Use it
}
}
$headers = array();
foreach(array_keys($_SERVER) as $skey)
{
if(substr($skey, 0, 5) == "HTTP_")
{
$headername = str_replace(" ", "-", ucwords(strtolower(str_replace("_", "
", substr($skey, 0, 5)))));
$headers[$headername] = $_SERVER[$skey];
}
}
return $headers;
}
?>
Original comment by read.ish...@gmail.com
on 13 Mar 2009 at 8:42
Here is another similar (almost the same) article about patching servers that
doesn't
have "apache_request_headers()" available (due to being running PHP as FastCGI
instead
of as an Apache module).
http://www.electrictoolbox.com/php-get-headers-sent-from-browser/
Original comment by mani...@gmail.com
on 10 May 2010 at 7:42
Original issue reported on code.google.com by
Alexei.Svitkine@gmail.com
on 17 Aug 2008 at 6:59