09 Jun

How to get RAW HTTP request in PHP for debugging

Here’s a quick way to log raw HTTP requests in PHP:

$env = print_r($_SERVER, TRUE);
$req = print_r($_REQUEST, TRUE);

$fp = fopen('/tmp/request.log', 'a');
fwrite($fp, $env);
fwrite($fp, $req);

where $env is environment parameters values and $req is request content. Handy.



Leave a Reply

Your email address will not be published. Required fields are marked *