This script allows you to lookup GeoIP data of any IP address the function of this API outputs the following
->Country
->Region
->City
->Country Code
->ISP
->Real User Agent
Demo here: http://gysms.net/tool
->Country
->Region
->City
->Country Code
->ISP
->Real User Agent
PHP Code:
<?php
$geo_ip=$_SERVER["REMOTE_ADDR"];
// Gets information about the current browser's user agent
$gysms_server_link = "http://gysms.net/geo/?ip=$geo_ip";
$host = $_SERVER['HTTP_HOST'];
$ch = curl_init() ;
curl_setopt( $ch, CURLOPT_URL, $gysms_server_link ) ;
curl_setopt( $ch, CURLOPT_HEADER, 0 ) ;
curl_setopt( $ch, CURLOPT_FRESH_CONNECT, 1 ) ;
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ) ;
curl_setopt($ch, CURLOPT_REFERER, $host);
curl_setopt( $ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"] ) ;
$result = curl_exec( $ch ) ;
curl_close( $ch ) ;
$details = json_decode($result);
$country = $details->country;
$region = $details->region;
$city = $details->city;
$country_code = $details->country_code;
$isp = $details->isp;
$browser = $details->browser;
echo "Country: <b>$country</b><br/>";
echo "Region: <b>$region</b><br/>";
echo "City: <b>$city</b><br/>";
echo "Country Code: <b>$country_code</b><br/>";
echo "ISP: <b>$isp</b><br/>";
echo "Real User Agent: <b>$browser</b><br/>";
?>
Demo here: http://gysms.net/tool