Skip to content

Instantly share code, notes, and snippets.

@brianherbert
Last active December 15, 2015 09:09
Show Gist options
  • Save brianherbert/5236749 to your computer and use it in GitHub Desktop.
Save brianherbert/5236749 to your computer and use it in GitHub Desktop.
Write to a log file to get the HTTP origin of requests
if (isset($_SERVER['HTTP_ORIGIN'])){
$log_text = $_SERVER['HTTP_ORIGIN'];
}else{
$log_text = 'UNKNOWN';
}
$filename = "./debug/origins.log";
$fh = fopen($filename, "a") or die("Could not open log file.");
fwrite($fh, date("d-m-Y, H:i")." - ".$log_text."\n") or die("Could not write file!");
fclose($fh);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment