it could be useful if you using nginx instead of apache
if (!function_exists('getallheaders'))
{
function getallheaders()
{
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
}
}
return $headers;
}
}
getallheaders
(PHP 4, PHP 5)
getallheaders — Získává všechny hlavičky HTTP požadavku
Popis
array getallheaders ( void )Tato funkce vrací asociativní pole všech HTTP hlaviček v současném požadavku.
Poznámka: Hodnotu běžných CGI proměnných můžete také získat tím, že je přečtete z prostředí, což funguje, ať používáte PHP jako modu Apache nebo ne. Pokud chcete vidět seznam všech systémových proměnných definovaných tímto způsobem, použijte phpinfo().
Příklad 145. getallheaders() Example
$headers = getallheaders();
while (list ($header, $value) = each ($headers)) {
echo "$header: $value<br>\n";
}
Tento příklad zobrazí všechny hlavičky současného požadavku.
Poznámka: getallheaders() je v současnosti podporována jen když PHP běží jako modul Apache™.
getallheaders
joyview at gmail dot com
06-Jul-2008 05:52
06-Jul-2008 05:52
lorro at lorro dot hu
19-Apr-2005 03:25
19-Apr-2005 03:25
Beware that RFC2616 (HTTP/1.1) defines header fields as case-insensitive entities. Therefore, array keys of getallheaders() should be converted first to lower- or uppercase and processed such.
