8

IPv4 から国へのコンバーターを正常に使用しています。例: マシンの IP を取得し、テーブルと比較して国を取得します。

私は現在これを更新しており、IPv6 を国に変換するための解決策があるかどうか尋ねたいと思っていました。

注: PHP と MySQL の優先順位

どうも

4

4 に答える 4

7

Web サービスの使用に問題がなければ、私のサービス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 応答を解析して国を取得するか、URL に国を追加することができます。

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

詳細については、 http://ipinfo.io/developersを参照してください。

于 2014-08-30T15:59:12.293 に答える
3

Maxmindは、GeoIP Country データベースで IPv6 をサポートしています。

于 2012-01-30T08:03:28.190 に答える
0

An easy way is to use an IP Geolocation API like my service: https://astroip.co which supports both IPv4 and IPv6.

Calling:

https://api.astroip.co/2c0f:fd58:9:198::255e/?api_key=1725e47c-1486-4369-aaff-463cc9764026

Returns:

{
  "status_code": 200,
  "geo": {
    "is_metric": true,
    "is_eu": false,
    "longitude": 24,
    "latitude": -29,
    "country_geo_id": 953987,
    "zip_code": null,
    "city": null,
    "region_code": null,
    "region_name": null,
    "continent_code": "AF",
    "continent_name": "Africa",
    "capital": "Pretoria",
    "country_name": "South Africa",
    "country_code": "ZA"
  },
  "asn": {
    "route": "2c0f:fd58::/32",
    "name": "Vox-Telecom",
    "type": "isp",
    "domain": "voxtelecom.co.za",
    "organization": "Vox-Telecom",
    "asn": "AS11845"
  },
  "currency": {
    "native_name": "Suid-Afrikaanse rand",
    "code": "ZAR",
    "name": "South African Rand",
    "symbol": "R"
  },
  "timezone": {
    "is_dst": false,
    "gmt_offset": 7200,
    "date_time": "2020-11-23T22:59:29+02:00",
    "microsoft_name": "South Africa Standard Time",
    "iana_name": "Africa/Johannesburg"
  },
  "security": {
    "is_crawler": false,
    "is_proxy": false,
    "is_tor": false,
    "tor_insights": null,
    "proxy_insights": null,
    "crawler_insights": null
  },
  "crypto": null,
  "user_agent": null,
  "error": null,
  "ip_type": "ipv6",
  "ip": "2c0f:fd58:9:198::255e"
}

You can find more details on https://astroip.co/docs

于 2020-11-23T21:02:56.103 に答える