Last active
December 15, 2015 09:09
-
-
Save brianherbert/5236749 to your computer and use it in GitHub Desktop.
Write to a log file to get the HTTP origin of requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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