Ip to country, city, lat, lang javascript service [closed]

给你一囗甜甜゛ 提交于 2019-12-05 05:36:40

问题


What the best/accurate/free service to convert the IP from the following script to country/city/lat/long?

$.getJSON("http://jsonip.appspot.com?callback=?",
    function(data){
       alert( "Data Returned: " + data.ip);
  });

回答1:


As it goes I was researching this the other day.

Couple of potential options:

  • FreeGeoIP

  • IP Info DB

Maxmind do a number of APIs but their JS service doesn't look up to task to my mind.




回答2:


I recommend installing something locally on your server as it will make a huge difference in terms of speed.

This one is great: MaxMind's GeoIP, and they have a free version with just a little less accuracy as the paid version.

You can download SQL tables or use a compiled C version with an Apache or PHP plugin.

MaxMind GeoIP City or MaxMind GeoIP Country




回答3:


Rather than using a 3rd-party API, I prefer to have the data locally. You potentially trade off a bit of accuracy for less latency and a more robust application.

The best free database I have found is IP address geolocation SQL database.



来源:https://stackoverflow.com/questions/1374178/ip-to-country-city-lat-lang-javascript-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!