The IP Address Geo-location API We Use
I had found an excellent IP address Geo-location API a few months ago to enhance a simple chat application I made for a church’s website. The nice things about this API are that it is automatically updated and kept current, the response time is very fast, the output is very easy to use XML, and it is free to use for 3 days.
I was using it when it was completely free up to a certain number of queries, but that offer has been discontinued, however the support team is gracious enough to allow me to be “grandfathered in” with free limited access.
Usage with a PHP application is very simple:
$ip = $_SERVER['REMOTE_ADDR'];
$key = 'yourKeyString';
$xml = simplexml_load_file("http://www.ipgp.net/api/xml/$ip/$key");
echo "The IP of $ip is from the country of $xml->Country, the region of $xml->Region, the city of $xml->City, and their ISP is $xml->Isp.";
The API has other features as well such as a link to the country’s flag as an XML node.