【问题标题】: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
【问题描述】:

我可以使用 Google Maps Data API 来获取 IP 地址信息,例如 Country、LatLong、City 等。结果将是 JSON 或 XML 格式,我可以通过 C# 解析。是否有适用于 Google Maps Data API 的 C# 库?

我发现了这个有趣的网站 http://www.ipinfodb.com/ip_location_api_json.php

这些家伙甚至提供了他们的 IP 地址位置数据库 http://ipinfodb.com/ip_database.php

【问题讨论】:

    标签: 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).')';
    ?>
    

    【讨论】:

      猜你喜欢
      • 2020-12-21
      • 2020-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-17
      • 2016-08-21
      • 2011-07-08
      • 1970-01-01
      相关资源
      最近更新 更多