Mar.16
2009

The topic of geo-targeting content has come up from time to time here at work but I’ve never taken the time to really implement it. So today I’ve been searching around for a solution and notice that it usually entails purchasing an IP database and a subscription for updates.

The idea of paying for something before testing out the implementation never sits well for me. So I was surprise to find www.hostip.info Community GeoTarget IP Project. Much like open source, everyone contributes to keep the database updated. Best of all, the API queries are free.

Here’s a sample of the API for a simple GET:

http://api.hostip.info/country.php
  US

http://api.hostip.info/get_html.php?ip=12.215.42.19
  Country: UNITED STATES (US)
  City: Sugar Grove, IL

http://api.hostip.info/get_html.php?ip=12.215.42.19&position=true
  Country: UNITED STATES (US)
  City: Sugar Grove, IL
  Latitude: 41.7696
  Longitude: -88.4588

http://api.hostip.info/?ip=12.215.42.19
  [use the URL above for an example - XML too long to paste below]

Use the API with a wget or a curl operation and you’re set.

2 comments so far

Add Your Comment
  1. These are great.

  2. Wonderfull…

Spam Protection by WP-SpamFree

Looking for something?

Use the form below to search the site: