I need some PHP code that does a dump of all the information in an HTTP request, including headers and the contents of any information included in a POST request. Basically, a diagnostic tool that spits out exactly what I send to a server.
Does anyone have some code that does this?
Simply add echo "<pre>"; before the var_dump() or print_r().
Cookie strings, web application technologies, and other data can be gathered from the HTTP Header. This information can be used when troubleshooting or when planning an attack against the web server.
HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon ( : ), then by its value. Whitespace before the value is ignored.
Lastly:
print_r($_REQUEST);
That covers most incoming items: PHP.net Manual: $_REQUEST
A simple way would be:
<?php print_r($_SERVER); print_r($_POST); print_r($_GET); print_r($_FILES); ?>
A bit of massaging would be required to get everything in the order you want, and to exclude the variables you are not interested in, but should give you a start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With