note 72498 added to function.apache-request-headers
| From: | jrabbit at osu1 dot php dot net | Date: | Sun, 21 Jan 2007 13:04:40 +0000 |
| Subject: | note 72498 added to function.apache-request-headers | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121983@lists.php.net to get a copy of this message | ||
The following code will implement an approximation of apache_request_headers for lighttpd making
most scripts that use the function portable between the two platforms.
Caveats are:
1. This function will convert any _ in a header key to a -
2. This function will capitalize the first character and first character after each hyphen in each
header key and lower case the rest of the key.
This does not cause a problem with standard headers which are capitalized in this manner but may
cause custom headers to appear in a different case to apache.
if (!function_exists('apache_request_headers')) {
eval('
function apache_request_headers() {
foreach($_SERVER as $key=>$value) {
if (substr($key,0,5)=="HTTP_") {
$key=str_replace("
","-",ucwords(strtolower(str_replace("_"," ",substr($key,5)))));
$out[$key]=$value;
}
}
return $out;
}
');
}
----
Server IP: 69.147.83.197
Probable Submitter: 82.35.127.9 (proxied: 1.2.3.4)
----
Manual Page -- http://www.php.net/manual/en/function.apache-request-headers.php
Edit -- https://master.php.net/note/edit/72498
Del: integrated -- https://master.php.net/note/delete/72498/integrated
Del: useless -- https://master.php.net/note/delete/72498/useless
Del: bad code -- https://master.php.net/note/delete/72498/bad+code
Del: spam -- https://master.php.net/note/delete/72498/spam
Del: non-english -- https://master.php.net/note/delete/72498/non-english
Del: in docs -- https://master.php.net/note/delete/72498/in+docs
Del: other reasons-- https://master.php.net/note/delete/72498
Reject -- https://master.php.net/note/reject/72498
Search -- https://master.php.net/manage/user-notes.php