ameliabob Posted July 21, 2009 Share Posted July 21, 2009 Is there a command that allows the server to capture the entire request as it is received as a string? Link to comment Share on other sites More sharing options...
boen_robot Posted July 21, 2009 Share Posted July 21, 2009 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 More sharing options...
ameliabob Posted July 21, 2009 Author Share Posted July 21, 2009 Is there a command that allows the server to capture the entire request as it is received as a string? Link to comment Share on other sites More sharing options...
ameliabob Posted July 21, 2009 Author Share Posted July 21, 2009 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 More sharing options...
boen_robot Posted July 21, 2009 Share Posted July 21, 2009 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 More sharing options...
justsomeguy Posted July 21, 2009 Share Posted July 21, 2009 Check the list of predefined variables also:http://www.php.net/manual/en/reserved.variables.phpThe $HTTP_RAW_POST_DATA variable holds the unprocessed POST request body, in addition to what boen mentioned. Link to comment Share on other sites More sharing options...
boen_robot Posted July 21, 2009 Share Posted July 21, 2009 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 More sharing options...
justsomeguy Posted July 21, 2009 Share Posted July 21, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.