- PVSM.RU - https://www.pvsm.ru -

Geolocation APIs: IP or W3C Geolocation?

For any webmaster interested to know where his users came from there are two methods available:

  • compare users IP address to a database of longitude/latitude or use an online API for this purpose;
  • or use a W3C HTML Geolocation API.


HTML Geolocation API [1] (Request from user using JS) provides scripted access to geographical location information associated with the hosting device. This is the most powerful and precise method of user's geolocation available.

Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs, as well as user input. Although W3C Geolocation API doesn't guarantee that the API returns the device's actual location it will try it's best for sure.

But it is more complicated to implement and it will require user to explicitly allow to use his location data:

image

List of the most reliable IP Geolocation APIs

IPData.co [2]
Endpoint: api.ipdata.co?api-key=test [3]
API Key: Required
API Latency: 65ms
Their smallest plan is $10 a month for 2500 requests daily or 75,000 requests a month.

Maxmind [4]
Endpoint: https://{account_id}:{license_key}@geoip.maxmind.com/geoip/v2.1/city/{ip}
API Key: Required
API Latency: 44ms
For basic city level geolocation via the City endpoint, it'll cost $400 per million calls or $0.0004 per request.

IPInfo.io [5]
Endpoint: ipinfo.io/json [6]
API Key: Not Required
API Latency: 165ms
Their Basic Plan  including  250,000 requests a month for a $49 monthly.

ipapi.com [7]
Endpoint: api.ipapi.com/api/161.185.160.93 [8]
API Key: Not Required
It's free for small projects up to 10,000 requests per month.

ipapi.co [9]
Endpoint: ipapi.co/json [10]
API Key: Not Required
API Latency: 270ms
It's free up to 1000 requests a day, than it'll cost starting from $15 monthly depending from a daily volume of requests.

db-ip.com [11]
Endpoint: api.db-ip.com/v2 [12]{api-key}/1.1.1.1
API Key: Required
API Latency: 225ms
It'll cost from €15.90 for 50,000 requests daily

ipwhois.io [13]
Endpoint: free.ipwhois.io/json [14]{IP} or free.ipwhois.io/xml [15]{IP}
API Key: Not Required
API Latency: 75ms
It's free for small projects up to 10,000 requests per month (IP and Referer identification).

Автор: ushim

Источник [16]


Сайт-источник PVSM.RU: https://www.pvsm.ru

Путь до страницы источника: https://www.pvsm.ru/geolocation-api/323100

Ссылки в тексте:

[1] HTML Geolocation API: https://www.w3.org/TR/geolocation-API/

[2] IPData.co: http://IPData.co

[3] api.ipdata.co?api-key=test: https://api.ipdata.co?api-key=test

[4] Maxmind: https://maxmind.com

[5] IPInfo.io: http://IPInfo.io

[6] ipinfo.io/json: https://ipinfo.io/json

[7] ipapi.com: https://ipapi.com

[8] api.ipapi.com/api/161.185.160.93: https://api.ipapi.com/api/161.185.160.93

[9] ipapi.co: http://ipapi.co

[10] ipapi.co/json: https://ipapi.co/json

[11] db-ip.com: http://db-ip.com

[12] api.db-ip.com/v2: https://api.db-ip.com/v2/

[13] ipwhois.io: https://ipwhois.io/

[14] free.ipwhois.io/json: http://free.ipwhois.io/json/

[15] free.ipwhois.io/xml: http://free.ipwhois.io/xml/

[16] Источник: https://habr.com/ru/post/405965/?utm_campaign=405965&utm_source=habrahabr&utm_medium=rss