Skip to content

Instantly share code, notes, and snippets.

@rskuipers
Created January 18, 2016 09:56
Show Gist options
  • Save rskuipers/467ead4cf31a15d252fc to your computer and use it in GitHub Desktop.
Save rskuipers/467ead4cf31a15d252fc to your computer and use it in GitHub Desktop.
<?php
$headers = getallheaders();
$contents = $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . ' ' . $_SERVER['SERVER_PROTOCOL'] . PHP_EOL;
foreach ($headers as $key => $value) {
$contents .= $key . ': ' . $value . PHP_EOL;
}
$contents .= PHP_EOL . file_get_contents('php://input');
file_put_contents(sys_get_temp_dir() . '/request-' . microtime(true) . '.log', $contents);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment