is it possible to write the IP and Location of the visitor in a file? this is my code:
<?php $line = date('Y-m-d H:i:s') . " - $_SERVER[REMOTE_ADDR]"; file_put_contents('visitors.log', $line . PHP_EOL, FILE_APPEND); ?>
But its only writing the IP down.
Now i have this code for Javascript (but this is only GET location and ip and yes i know im noob):
<script> $.get("http://ipinfo.io", function (response) {
$("#ip").html("IP: " + response.ip);
$("#address").html("Location: " + response.city + ", " + response.region);
$("#details").html(JSON.stringify(response, null, 4)); }, "jsonp");</script>
Is it possible to put that in a file? Thank you in advanced.