Last active
May 5, 2018 18:30
-
-
Save KamranSyed/e67bb48136aedd36a9f5904822f149de to your computer and use it in GitHub Desktop.
Find Location by IP Address using PHP
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
| <?php | |
| /** | |
| * This is part of a video tutorial | |
| * at https://youtu.be/_HqS12AOwTk | |
| * relevant instructions can be found | |
| * in the description below the video. | |
| */ | |
| $ip = $_SERVER['REMOTE_ADDR']; | |
| $location = file_get_contents('http://ip-api.com/json/'.$ip ); | |
| $locData = json_decode($location, true); | |
| echo "<pre>"; | |
| print_r($locData); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment