A nice little function I found posted by “lazynitwit” on BlueHost forums:
$headers = array();
foreach ($_SERVER as $k => $v)
if (substr($k, 0, 5) == "HTTP_")
$k = str_replace('_', ' ', substr($k, 5));
$k = str_replace(' ', '-', ucwords(strtolower($k)));
$headers[$k] = $v;
The PHP function getallheaders() only works on Apache, and only if Apache has been installed as a module.
It turns out that this information is within the $_SERVER global variable, and can be parsed out.
whenever a request is made. I have put this to use in my phpFreeChat chat box to allow channels to be specified in the URL as GET parameters.