private static function OAuthRequest::get_headers in OAuth 1.0 6
helper to try to sort out headers for people who aren't running apache
1 call to OAuthRequest::get_headers()
- OAuthRequest::from_request in ./
OAuth.php - attempt to build up a request from what was passed to the server
File
- ./
OAuth.php, line 428
Class
Code
private static function get_headers() {
/*{{{*/
if (function_exists('apache_request_headers')) {
// we need this to get the actual Authorization: header
// because apache tends to tell us it doesn't exist
return apache_request_headers();
}
// otherwise we don't have apache and are just going to have to hope
// that $_SERVER actually contains what we need
$out = array();
foreach ($_SERVER as $key => $value) {
if (substr($key, 0, 5) == "HTTP_") {
// this is chaos, basically it is just there to capitalize the first
// letter of every word that is not an initial HTTP and strip HTTP
// code from przemek
$key = str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($key, 5)))));
$out[$key] = $value;
}
}
return $out;
}