IPGeolocation (http://www.jooria.com/scripts/Geography-139/IPGeolocation-954/index.html) is a PHP class which provides an easy-to-use interface to the IP Address Location XML API described at ipinfodb.com. This API allows you to find the city, state/region, and country associated with an IP address, as well as the address's approximate latitude and longitude.
Usage:
require_once('IPGeolocation.class.php');
$location = new IPGeolocation($ipAddressString);
// do some error checking here
$strCityStateCountry = $location->getFriendlyLocation();
this is really usefull script recently i saw many people ask how i can get the country from an ip
use quick view tools:IPGeolocation.class.php [9.76 KB] (http://www.jooria.com/view/file/472/1) or download:ipgeolocation-1.0.zip [3.8 KB] (http://www.jooria.com/downloads/472/ipgeolocation-1.0.zip)