Skip to main content

IP Geolocation API – IPWHOIS.IO

The Geolocation is identification of an object in a geographic location. It includes information related to latitude, longitude, address, country code, country, zip code and more.

Geolocation data is useful for businesses to know about customers to target with relevant information. Due to importance, the businesses always looking for geolocation data of their customers. It’s not an easy task to get the accurate geolocation data, but thanks to the IPWHOIS.IO Geolocation API which provide the accurate geolocation solution.

IPWHOIS.IO provide fast and accurate gelocation data from across the world. The API is very easy to integrate and deliver results in JSON, XML or Newline format. It is totally free for up to 10,000 requests per month. IPWHOIS.IO API is used by thousands of developers all around the world.

Also, read:

Special features:

  • Free to use up to 10,000 requests per month.
  • Provide fast and accurate gelocation data
  • Provide real-time geolocation data.
  • It’s Simple, Fast and Powerfull.
  • Multilingual response.
  • Provides secure data.
  • Reasonable pricing for small to large sized websites.
  • Documentation with code samples in PHP, JavaScript, jQuery, Python, and more.

The API integration is very easy and quick, there are no need to do signup to get the access keys etc. We just need to make HTTP request to API with IP Address to get geolocation data.

The URL format for IPWHOIS.IO IP Geolocation API is simple:

http://ipwhois.app/json/{IP}

For example, we can make API request with following IP Address 47.9.123.84,

We can easily integrate the API with any programming language. As the IPWHOIS.IO IP does not require any registration or signup, so we just need to make HTTP request to the API to get the geolocation data.

In below example code, we will make HTTP request to http://ipwhois.app/json/{IP} using PHP CURL and pass IP Address 47.9.123.84 to get the data in JSON format.

<?php

$ip_address = $_SERVER['REMOTE_ADDR'];

$ch = curl_init('http://ipwhois.app/json/'.$ip_address);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json_data = curl_exec($ch);
curl_close($ch);

$result = json_decode($json_data, true);
var_dump($result);

?>

When we run the above code with IP Address 47.9.123.84 and we will get the following geolocation response in JSON format:

{
  "ip": "47.9.123.84",
  "success": true,
  "type": "IPv4",
  "continent": "Asia",
  "continent_code": "AS",
  "country": "India",
  "country_code": "IN",
  "country_flag": "https://cdn.ipwhois.io/flags/in.svg",
  "country_capital": "New Delhi",
  "country_phone": "+91",
  "country_neighbours": "CN,NP,MM,BT,PK,BD",
  "region": "Uttar Pradesh",
  "city": "Lucknow",
  "latitude": 26.8466937,
  "longitude": 80.946166,
  "asn": "AS55836",
  "org": "Reliance Jio Infocomm Limited",
  "isp": "Reliance Jio Infocomm Limited",
  "timezone": "Asia/Calcutta",
  "timezone_name": "India Standard Time",
  "timezone_dstOffset": 0,
  "timezone_gmtOffset": 19800,
  "timezone_gmt": "GMT +5:30",
  "currency": "Indian Rupee",
  "currency_code": "INR",
  "currency_symbol": "₹",
  "currency_rates": 73.1285,
  "currency_plural": "Indian rupees",
  "completed_requests": "4"
}

Conclusion

Here in this post, we have explained how to integrate the IPWHOIS.IO API to get the accurate geolocation data. You can checkout the documentation to integrate with advance options.

You may also like: