Skip to content

Instantly share code, notes, and snippets.

@tiagopassinato
Last active April 28, 2016 14:50
Show Gist options
  • Save tiagopassinato/97628aae6ee973b21e74c1fbafd999ef to your computer and use it in GitHub Desktop.
Save tiagopassinato/97628aae6ee973b21e74c1fbafd999ef to your computer and use it in GitHub Desktop.
This little script logs all requests to a text file. (Useful for Restler and other scripts)
<?php
/**
* Logs all requests (Post, Json, etc.)
*/
$logFile = '../logs/flow.log';
$postdata = $_SERVER['REQUEST_URI']."\n".file_get_contents('php://input');
if($_POST)
$postdata.="\nPOST:\n".print_r($_POST,true)." \n";
if($_FILES)
$postdata.="FILES:\n".print_r($_FILES,true);
file_put_contents($logFile, $postdata."\n\n", FILE_APPEND);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment