如何使用maxmind从IP地址获取经度和纬度? [英] How to get latitude and longitude from IP address using maxmind?

查看:110
本文介绍了如何使用maxmind从IP地址获取经度和纬度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在使用geoip php扩展名.此扩展程序无法像以前那样为我提供纬度和经度.

I have been using geoip php extension for a while. This extension does not provide me latitude and longitude as it was doing before.

在maxmind网站内部,我可以阅读:

Looking inside maxmind website I can read:

注意:经过仔细考虑,考虑到客户反馈,我们已决定不删除纬度​​和经度来自GeoLite2数据库的坐标.我们正在查看我们所有GeoLite2和GeoIP数据库中使用的坐标确保没有滥用风险.

Note: After careful consideration, taking into account customer feedback, we have decided against removing latitude and longitude coordinates from the GeoLite2 databases. We are in the process of reviewing coordinates used in all of our GeoLite2 and GeoIP databases to ensure there is no risk of misuse.

还有其他方法(或免费替代方法)从IP地址获取纬度和经度吗?

Is there another way (or free alternative) to get latitude and longitude from IP address ?

推荐答案

http://ip-api.com/即可使用.

http://ip-api.com/json/111.222发出GET请求.333.444/(在您要查找的末尾附加您自己的IP)

Make a GET request to http://ip-api.com/json/111.222.333.444/ (append your own IP at the end which you wish to look up)

结果将如下所示:

{
    "status": "success",
    "country": "COUNTRY",
    "countryCode": "COUNTRY CODE",
    "region": "REGION CODE",
    "regionName": "REGION NAME",
    "city": "CITY",
    "zip": "ZIP CODE",
    "lat": LATITUDE,
    "lon": LONGITUDE,
    "timezone": "TIME ZONE",
    "isp": "ISP NAME",
    "org": "ORGANIZATION NAME",
    "as": "AS NUMBER / NAME",
    "query": "IP ADDRESS USED FOR QUERY"
}

我相信这是您要询问的数据;LAT/LON是此API的标准返回值.请注意,不要每分钟执行超过150个请求,否则它们将禁止您的主机提出进一步的请求.

I believe this is the kind of data you were asking about; LAT/LON are a standard return with this API. Note do not perform over 150 requests per minute otherwise they will ban your host from making further requests.

这篇关于如何使用maxmind从IP地址获取经度和纬度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆