Jump to content

Using An Entire Request


ameliabob

Recommended Posts

If you have the pecl_http extension, you can construct it yourself manually with a few function calls.What do you need it for anyway? Logging? If so, consider doing it on the web server layer. If you need to reexecute the request (possibly with some changes - like a proxy), pecl_http provides you with everything you'll need, and then some. If you want to make sure your PHP is secure (without actually keeping logs), consider using tools like Fiddler.

Link to comment
Share on other sites

If you have the pecl_http extension, you can construct it yourself manually with a few function calls.What do you need it for anyway? Logging? If so, consider doing it on the web server layer. If you need to reexecute the request (possibly with some changes - like a proxy), pecl_http provides you with everything you'll need, and then some. If you want to make sure your PHP is secure (without actually keeping logs), consider using tools like Fiddler.
I am trying to log requests and then build a test case library from that.
Link to comment
Share on other sites

I am trying to log requests and then build a test case library from that.
Test for the PHP itself? Is so, consider keeping tracks of the things that really matter, in a form that matters - the $_GET, $_POST and $_COOKIE arrays, as well as the request headers array, and then test your functions or whatever against them. serialize() them in a file or something, then upon testing, unserialize() and use them.If you still want the most raw power possible, process the headers array (by which I mean translate it into its raw form) and add to that raw form the raw request body.
Link to comment
Share on other sites

The $HTTP_RAW_POST_DATA variable holds the unprocessed POST request body, in addition to what boen mentioned.
I like this variable... but it seems that unless your request body contains improper data, this variable never appears. Yes, you can force it with php.ini, but at a performance cost they say. The comment on the mentioned function mentiones the 'php://input' stream, which is perhaps a better (and certainly more portable) solution.
Link to comment
Share on other sites

Odd, that doesn't really match with what I've seen, but I guess I'll believe it. I used that to work around an IE bug where IE was trashing the content type header, but all other browsers were submitting correct requests. I thought it worked everywhere, maybe I didn't test it in the other browsers though.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...