Re: HTTP request contents
| From: | Chris Shiflett | Date: | Fri, 24 Oct 2003 13:52:59 +0000 |
| Subject: | Re: HTTP request contents | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167424@lists.php.net to get a copy of this message | ||
--- Hanuska Ivo <hanuska@asd-software.cz> wrote:
> I need to know, if there is a possibility to read full contents of
> HTTP request. I know, the response can be sent by header() function.
> But can I get the request of the client for server?
In a way, yes, although most of this information is nicely parsed for you by
the time PHP has its turn. Look in the $_SERVER superglobal for many of the
headers:
print_r($_SERVER);
Most headers (I think all) begin with HTTP, as in $_SERVER['HTTP_USER_AGENT']
for the User-Agent header. The request line itself is broken into the method,
requested resource, and version.
There is also a nice function called apache_request_headers:
http://www.php.net/apache_request_headers
If you're using an older version, this might be called getallheaders.
Hope that helps.
Chris
=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp