1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php
/**
The following function gets the http headers of a client request
when php is running as CGI
*/
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;
}
}