IP到国家 - IPv6

问题描述 投票:8回答:3

我一直在成功使用IPv4到国家转换器。例如:获取机器的IP并与表进行比较以获得国家。

我目前正在更新这个,并且我想问一下IPv6是否有将IPv6转换为国家的解决方案?

注意:偏爱PHP和MySQL

谢谢

ipv6 ip-geolocation
3个回答
5
投票

如果你可以使用网络服务,那么我的服务http://ipinfo.io最近添加了IPv6支持:

$ curl http://ipinfo.io/2001:4860:4860::8888
{
  "ip": "2001:4860:4860::8888",
  "hostname": "No Hostname",
  "city": null,
  "region": null,
  "country": "US",
  "loc": "38.0000,-97.0000",
  "org": "AS15169 Google Inc."
}

您可以解析JSON响应以获取国家/地区,也可以将国家/地区添加到网址:

$ curl http://ipinfo.io/2001:4860:4860::8888/country
US

有关详细信息,请参阅http://ipinfo.io/developers


3
投票

Maxmind在其GeoIP国家数据库中支持IPv6。


3
投票

这是https://ipdata.co的一个例子

curl https://api.ipdata.co/2c0f:fd58:9:198::255e?api-key=test

这使

{
    "ip": "2c0f:fd58:9:198::255e",
    "city": "",
    "region": "",
    "country_name": "South Africa",
    "country_code": "ZA",
    "continent_name": "Africa",
    "continent_code": "AF",
    "latitude": -29.0,
    "longitude": 24.0,
    "asn": "AS20940",
    "organisation": "Akamai International B.V.",
    "postal": "",
    "currency": "ZAR",
    "currency_symbol": "R",
    "calling_code": "27",
    "flag": "https://ipdata.co/flags/za.png",
    "time_zone": "Africa/Johannesburg"
}⏎ 
© www.soinside.com 2019 - 2024. All rights reserved.