Skip to content

Instantly share code, notes, and snippets.

@vseow
Last active September 3, 2019 09:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vseow/66919c14f3e2d9261902 to your computer and use it in GitHub Desktop.
Save vseow/66919c14f3e2d9261902 to your computer and use it in GitHub Desktop.
Get Country from IP with PHP
<?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;
?>
@ELoukili
Copy link

ELoukili commented Sep 3, 2019

thank youuuuuuu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment