Re: [PHP] HTTP request contents

From: Chris Shiflett (shiflett_at_php.net)
Date: 10/24/03


Date: Fri, 24 Oct 2003 06:52:59 -0700 (PDT)
To: Hanuska Ivo <hanuska@asd-software.cz>, php-general@lists.php.net


--- 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



Relevant Pages

  • Re: W2K3 IIS 6.0 ASP.NET Requests Per Second Limits?
    ... Web Page makes HTTP request to web service ... Web Page waits for HTTP response to return ... Since ASP.Net depends on the worker threads to "do work", ...
    (microsoft.public.inetserver.iis)
  • retrieving yahoo! mail ?
    ... I looked at the source html for the yahoo mail login page at: ... I would get a Bad Request error: ... I discovered that the Host header is the only ... one that is necessary to get a response. ...
    (comp.lang.ruby)
  • Re: SOAPACTIOn Missing!
    ... The SOAP 1.1 specification says this about the HTTP SOAPAction header; ... The SOAPAction HTTP request header field can be used to indicate the ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: W2K3 IIS 6.0 ASP.NET Requests Per Second Limits?
    ... I think I grasp the concept between the two scenarios sync and async. ... Web Page displays the content of the HTTP response ... Now with this example when I send the request to temperature webservice ... > queue's up the HTTP request and immediately returns back and can ...
    (microsoft.public.inetserver.iis)
  • [REVS] Forging HTTP Request Headers with Flash ActionScript
    ... Forging HTTP Request Headers with Flash ActionScript ... A similar syntax will send POST request (with the same header, ...
    (Securiteam)