PHP » PYTHON |
login |
register |
about
|
PYTHON apache_request_headers
is this article helpful?
|
Python replacement for PHP's apache_request_headers
[
edit
| history
]
import os def apache_request_headers(): resheaders={} for headername, headervalue in os.environ.items(): if headername.startswith("HTTP_"): cha=headername.split("_") cha.pop(0) resheaders[str.join("-",cha).title()]=headervalue if headername.startswith("CONTENT_"): cha=headername.split("_") resheaders[str.join("-",cha).title()]=headervalue return resheaders apache_request_headers(PHP 4 >= 4.3.0, PHP 5) apache_request_headers — Fetch all HTTP request headers Description
array apache_request_headers
( void
)
Fetches all HTTP request headers from the current request. This function is only supported when PHP is installed as an Apache module. Return ValuesAn associative array of all the HTTP headers in the current request, or FALSE on failure. Examples
Example #1 apache_request_headers() example
<?php The above example will output something similar to: Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 Host: www.example.com Connection: Keep-Alive
Notes
|
more
Recently updated
more
Most requested
more
Last requests
|