Skip to main content

IP address city geolocation HTTP API

This might come in handy one day: blogama.org maintains a geolocation database.
Modified from his website:

How to use our HTTP API to get ip geolocation information such as country, city, region, zipcode (US-CA), latitude and longitude. We offer 2 type of output, xml and CVS.

IP address geolocation

You have 2 variable to set: ip and output.

  • ip : the IP address you want to get info from (123.123.123.123)
  • output : either raw or xml.

Here is an example :

http://blogama.org/ip_query.php?ip=74.125.45.100&output=xml

would output :

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Ip>74.125.45.100</Ip>
<Status>OK</Status>
<CountryCode>US</CountryCode>
<CountryName>United States</CountryName>
<RegionCode>CA</RegionCode>

<RegionName></RegionName>
<City>Mountain View</City>
<ZipPostalCode>94043</ZipPostalCode>
<Latitude>37.4192</Latitude>
<Longitude>-122.057</Longitude>
</Response>

while :

http://blogama.org/ip_query.php?ip=74.125.45.100&output=raw

would output CSV :

74.125.45.100,OK,US,United States,CA,,Mountain View,94043,37.4192,-122.057

Tried it on my current (dynamic) address:

91.177.243.80,OK,BE,Belgium,09,West-Vlaanderen,Westende,,51.1667,2.7667

Some 30km off target...

Not that it is very useful but you can query google maps using the latitude and longtitude:

http://maps.google.com/maps?q=51.1667,+2.7667&hl=en

Comments