We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
另一个具有城市准确信息的免费 REST API 是 http://freegeoip.net 请求相当简单。您可以使用类似
对 IP 地址进行地理编码的方法,其中格式可以是
csv
、xml
或json
。他们的网站有所有详细信息。[更新:] FreeGeoIP.net 过去并未作为公共服务持续提供。不过,该软件始终是开源的,可以在 Github 上获取。如果您需要高度可靠的服务或者您的用例超过当前 15.000 个请求/小时的配额,那么使用 Docker 运行本地安装相当容易。
Another free REST API with city accurate information would be http://freegeoip.net Requests are fairly straight forward. You would use something like
to geocode an IP address, where format can be
csv
,xml
orjson
. Their website has all the details.[UPDATE:] FreeGeoIP.net was not continuously available in the past as a public service. The software was, however, always open source and is available on Github. It's fairly easy to get your local installation running using Docker, if you need a highly reliable service or your use case exceeds the current quota of 15.000 requests/hour.
这是几个简单的调用...
调用示例:-
返回的 XML 示例 (ipinfodb) :-
Here's a couple with simple calls...
Example calls :-
Example of returned XML (ipinfodb) :-
您可以使用谷歌 API:
http://code.google.com/apis/ajax/documentation/#ClientLocation
编辑
示例:
You could use the google API:
http://code.google.com/apis/ajax/documentation/#ClientLocation
Edit
Example:
在我的网站上,我使用 http://ip-api.com/ 从 IP 地址获取位置。 他们有很好的限制(每分钟最多 150 个请求)。 Ipinfo.io 仅对每天少于 1000 个请求免费。
这是示例输出:
这是您可以使用的 PHP 代码:
On my site I use http://ip-api.com/ for getting location from IP address. They have nice limits (up to 150 request per minute). Ipinfo.io is free only for less then 1000 requests per day.
This is sample output:
This is PHP code you can use:
您可以在这里找到始终更新的免费地理数据库
http://www.maxmind.com/app/geolitecity
您可以创建一个新的 C# 服务像这样使用这个地理数据库
http://www.maxmind.com/app/csharp
您可以通过以下链接在线尝试
http://www.maxmind.com/app/lookup_city
You can find a FREE Geo database always updated here
http://www.maxmind.com/app/geolitecity
and you can create a new C# service to use this Geo DB like
http://www.maxmind.com/app/csharp
you can try it online with below link
http://www.maxmind.com/app/lookup_city