Get HTTP Request Headers
When you're running on a server that does not support the PHP function apacherequestheaders this little function will do the same for you
function get_request_headers() {
$headers = array();
foreach($_SERVER as $k => $v) {
if (substr($k, 0, 5) <> 'HTTP_') {
continue;
}
$header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($k, 5)))));
$headers[$header] = $v;
}
return $headers;
}
Note that the function will change upper/lowercase so the request header installedVersion will be Installedversion.
Written by Björn Kaiser
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Related Tags
#php
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#