Last active
July 5, 2016 19:46
-
-
Save ryanscherler/006c660a0cda875eda9336dccbe19c3a to your computer and use it in GitHub Desktop.
Get approximate geo location from public IP.
This file contains 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
<?php | |
$ip = file_get_contents('https://api.ipify.org'); | |
$location = file_get_contents('http://freegeoip.net/json/'.$ip); | |
print_r($location) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment