Last active
September 3, 2019 09:35
-
-
Save vseow/66919c14f3e2d9261902 to your computer and use it in GitHub Desktop.
Get Country from IP with PHP
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 = $_SERVER['REMOTE_ADDR']; | |
//echo $ip; | |
// Docs: http://ip-api.com/docs/ | |
// Capped at 250 lookups/min - can unban yourself if you go over http://ip-api.com/docs/unban | |
$xml = simplexml_load_file("http://ip-api.com/xml/".$ip); | |
echo $xml->country; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank youuuuuuu