tags:

views:

62

answers:

2

Sorry for so noobish question but how can I do it with C++? I need to get country names and their 2-letter or 3-letter ISO codes (or whatever it's called) using a given IP address. Is there any way to do this easily?

The only two ways I found are to use GeoIP C library or to download a free database but is there something more dynamic? I mean, is there a free web-service with up-to-date db I can utilize for my purpose using curl or something?

Thanks in advance.

+1  A: 

MaxMind.com exposes a set of web services for geolocation. They're not free, but cheap per lookup.

One of my clients uses their city-level lookup service, with each result cached for a reasonable period (from memory, 2 or 3 weeks), since IP address blocks don't change location that often.

The application also counts the number of actual lookups to send an admin notification when the number remaining in the subscription gets low, so it can be topped up manually.

I also use the downloadable database in several applications, with a scheduled update process to keep it up to date.

devstuff
I use MaxMind also. There are some examples on integrating their GeoIP with various languages. http://www.maxmind.com/app/api
Craig
A: 

http://www.hostip.info provides an API.

kmoser