Skip to content

Instantly share code, notes, and snippets.

@unusorin
Created September 19, 2012 12:42
Show Gist options
  • Save unusorin/3749435 to your computer and use it in GitHub Desktop.
Save unusorin/3749435 to your computer and use it in GitHub Desktop.
IP or Domain Geolocation
function IPGeolocation($IpOrHostname,$Format="json"){
$response = file_get_contents("http://freegeoip.net/".$Format."/".$IpOrHostname);
return json_decode($response);
}
print_r(IPGeolocation("86.124.164.62"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment