惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
AI
AI
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
U
Unit 42
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
Microsoft Security Blog
Microsoft Security Blog
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
B
Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
F
Full Disclosure
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Help Net Security
Recorded Future
Recorded Future
N
News and Events Feed by Topic
雷峰网
雷峰网
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Project Zero
Project Zero
罗磊的独立博客
G
GRAHAM CLULEY
腾讯CDC
P
Privacy International News Feed
V
V2EX
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
H
Heimdal Security Blog
L
LINUX DO - 热门话题
Forbes - Security
Forbes - Security
美团技术团队
MongoDB | Blog
MongoDB | Blog
Security Latest
Security Latest
M
MIT News - Artificial intelligence
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
宝玉的分享
宝玉的分享
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog

Impressive Webs

Transforming Healthcare with VR: Virtual Surgery and Patient Simulation YouTube's Time-Based UX Problem for Live Sports Don't Let ChatGPT Write Your Code CSS Rules vs. CSS Rulesets - Impressive Webs Filestack: A File Uploader and Powerful APIs for App Content Delivery How to Disable JavaScript in Almost Any Browser - Impressive Webs Detecting Specific Text Input with HTML and CSS The Most Interesting Developer Tools for 2021 - Impressive Webs Fading in a Page on Load with CSS & JavaScript
A Review of ipwhois.io for Reliable Geolocation Data
https://www.facebook.com/ImpressiveWebs/ · 2022-02-07 · via Impressive Webs

The following is a sponsored article for ipwhois.io, a fast IP Geolocation API service for developers.

If you’re building an app that requires delivering a dynamic experience based on the user’s location or other location-related data, a fast and easy-to-use Geolocation API will certainly come in handy. One such option is ipwhois.io. The service, which is free for small non-commercial projects that need fewer than 10,000 requests per month, is easy to integrate with your tech stack.

ipwhois.io

As usual, it’s always best to look at a few examples so you can see it in action. Their documentation is short and easy to follow, so I’ll demonstrate using the following example request:

http://ipwhois.app/json/52.149.246.39

Notice a few things in the above URL:

  • It’s using the ipwhois.app domain, which is different from the primary domain ipwhois.io
  • I’m requesting JSON data, but I could alternatively use “xml” or “csv” by adjusting the URL
  • I’ve appended the IP address that I want to get info for

You can run the request as a cURL command in your terminal or visit the URL directly in your browser. Try one of the following links:

The payload that’s returned for the JSON request looks something like this (I’ve prettified it for readability):

{
  "ip":"52.149.246.39",
  "success":true,
  "type":"IPv4",
  "continent":"North America",
  "continent_code":"NA",
  "country":"United States",
  "country_code":"US",
  "country_flag":"https:\/\/cdn.ipwhois.io\/flags\/us.svg",
  "country_capital":"Washington",
  "country_phone":"+1",
  "country_neighbours":"CA,MX,CU",
  "region":"Virginia",
  "city":"Ashburn",
  "latitude":39.0437567,
  "longitude":-77.4874416,
  "asn":"AS8075",
  "org":"Microsoft Corporation",
  "isp":"Microsoft Corporation",
  "timezone":"America\/New_York",
  "timezone_name":"Eastern Standard Time",
  "timezone_dstOffset":0,
  "timezone_gmtOffset":-18000,
  "timezone_gmt":"GMT -5:00",
  "currency":"US Dollar",
  "currency_code":"USD",
  "currency_symbol":"$",
  "currency_rates":1,
  "currency_plural":"US dollars",
  "completed_requests":15
}

For demonstration purposes in this instance, the IP I used was the IP address for DuckDuckGo. (As a side point, it’s interesting that the “org” in this payload is listed as “Microsoft Corporation”; I’m assuming this is because DuckDuckGo uses Bing as the basis for its search results as they aren’t a Microsoft-owned company.)

The above JSON payload includes a lot of info, but you can immediately see how it can be useful in your apps. Some of the bits of data you might be interested in include:

  • Continent and two-letter continent code
  • Country and two-letter country code
  • Country phone code (e.g. +1)
  • 5 different bits of time zone-related values
  • 5 different bits of currency-related values

Each request also returns a success Boolean representing whether the request was successful along with an accompanying error message when the value is false.

As mentioned, there’s quite a bit of info on each request. But you don’t need to request all of it – you can limit which fields are returned by using query string parameters:

http://ipwhois.app/xml/52.149.246.39?objects=country,city,timezone,currency

The payload for the above request (which asks for XML instead of JSON) would be:

<query>
  <country>United States</country>
  <city>Ashburn</city>
  <timezone>America/New_York</timezone>
  <currency>US Dollar</currency>
</query>

The request is also available as a JSONP callback. Simply change the URL to include the callback parameter, which you can set to the name of your callback function:

http://ipwhois.app/json/52.149.246.39?objects=country,city,timezone,currency&callback=myIPInfo

The above would return the following:

myIPInfo({
  "country":"United States",
  "city":"Ashburn",
  "timezone":"America\/New_York",
  "currency":"US Dollar"
});

Lastly, you can also append a lang parameter for localization:

http://ipwhois.app/json/52.149.246.39?objects=country,continent,success,currency&lang=fr

The result:

{
  "success":true,
  "continent":"Am\u00e9rique du Nord",
  "country":"\u00c9tats-Unis",
  "currency":"US Dollar"
}

Notice for the request I used “fr” (French) as the language, so this is reflected in the data returned.

As mentioned, if you’re building something for non-commercial use that’s under 10,000 requests per month, you can use ipwhois.io free of charge. For details on commercial usage or projects that require 10,000 request or more, check out the pricing page.

ipwhois.io is a continuously reliable service – they use a neural network that analyzes dozens of sources to update their database in almost real-time. Overall, this is a solid solution for integrating IP-based geolocation data into your JavaScript, Python, PHP, or jQuery apps (there’s code examples for each in the docs).