Using the ip-api.com JSON API and ResolveIp we can get the country where a site is hosted:
The following API request http://ip-api.com/json/91.189.43.102 returns this JSON response:
So we use ResolveIp to get the ip of the site and JsonPathOnUrl on to parse the result:
=JsonPathOnUrl("http://ip-api.com/json/"&ResolveIp("http://nielsbosma.se");"$.country";HttpSettings(TRUE;;;"240|240|Host"))
Note the usage limits from their documentation:
Our system will automatically ban any IP addresses doing over 250 requests per minute. You are free to use ip-api.com for non-commercial use. We do not allow commercial use without prior approval.
Note that I added a interval between request of 240ms between requests using HttpSettings to make sure my IP won't get blocked.
Comments