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

推荐订阅源

Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
LangChain Blog
月光博客
月光博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
博客园_首页
T
Tailwind CSS Blog
P
Proofpoint News Feed
雷峰网
雷峰网
D
Darknet – Hacking Tools, Hacker News & Cyber Security
IT之家
IT之家
V
Vulnerabilities – Threatpost
阮一峰的网络日志
阮一峰的网络日志
C
CERT Recently Published Vulnerability Notes
Attack and Defense Labs
Attack and Defense Labs
S
Schneier on Security
Security Archives - TechRepublic
Security Archives - TechRepublic
L
Lohrmann on Cybersecurity
V
Visual Studio Blog
云风的 BLOG
云风的 BLOG
WordPress大学
WordPress大学
The Register - Security
The Register - Security
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
Project Zero
Project Zero
博客园 - 叶小钗
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
Latest news
Latest news
S
SegmentFault 最新的问题
C
Cyber Attacks, Cyber Crime and Cyber Security
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
L
LINUX DO - 最新话题
Google DeepMind News
Google DeepMind News
P
Privacy International News Feed
I
InfoQ
F
Fortinet All Blogs
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threatpost
T
Tenable Blog
B
Blog RSS Feed

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).