public function refreshRequestHeaders() { // clear old headers self::$aRequestHeaders = array(); // use the apache function, if possible if (function_exists('apache_request_headers')) { $aRequestHeaders = apache_request_headers(); // make sure that all keys have the same case format foreach ($aRequestHeaders as $sKey => $sVal) { $sKey = $this->formatKey($sKey, '-'); self::$aRequestHeaders[$sKey] = $sVal; } } else { foreach ($_SERVER as $sKey => $sVal) { // we need the "HTTP_*" keys only if (substr($sKey, 0, 5) != 'HTTP_') { continue; } $sKey = $this->formatKey(substr($sKey, 5), '_'); self::$aRequestHeaders[$sKey] = $sVal; } } }