tags:

views:

2513

answers:

2

I was wondering if there was a way to get at the raw HTTP request data in PHP running on apache that doesn't involve using any additional extensions. I've seen the HTTP functions in the manual, but I don't have the option of installing an extension in my environment.

While I can access the information from $_SERVER, I would like to see the raw request exactly as it was sent to the server. PHP munges the header names to suit its own array key style, for eg. Some-Test-Header becomes HTTP_X_SOME_TEST_HEADER. This is not what I need.

+4  A: 

do you mean the information contained in $_SERVER?

print_r($_SERVER);

edit:

ah would this do then?

foreach(getallheaders() as $key=>$value)  {
    print $key.': '.$value."<br />";
}
Owen
Yes, but i want the raw request before it gets parsed into $_SERVER by PHP
Shabbyrobe
A: 

Use the following php wrapper:

$raw_post = file_get_contents("php://input");

Bretticus
I don't think that gets the http headers though.
MattSmith