【问题标题】:Get IP Address Information such as Country, LatLong, City using Google Maps Data API使用 Google Maps Data API 获取 IP 地址信息,例如 Country、LatLong、City
【发布时间】:2011-01-22 13:36:26
【问题描述】:
【问题讨论】:
标签:
c#
json
google-maps
geolocation
【解决方案1】:
描述:http://s.site90.com/api-xml.php
php代码:
<?
$ip = $_SERVER["REMOTE_ADDR"];// or ex. "92.32.207.124"
$data = simplexml_load_string(file_get_contents("http://s.site90.com/api/xml.php?type=ip&ip=".$ip));
//echo print_r($data);
echo '<img src="data:image/png;base64,'.utf8_decode($data->ip->countryimage->attributes()->small).'"> '.utf8_decode($data->ip->location->attributes()->city).' ('.utf8_decode($data->ip->location->attributes()->region).')';
?>