views:

152

answers:

4

Is anyone aware of a (preferablly free) webservice that would accept a SOAP or REST request.

This request would contain an IP address, and the service would return an approximation of that IP's location.

EDIT: I need resolution down to the city of possible.

+2  A: 

MaxMind do a fairly cheap one. You send the IP as a query string parameter, then it sends you back either a 2 letter code or an error code. We used it for quite a while before moving to our own lookup tables, and it's quick and reliable.

Found the link: http://www.maxmind.com/app/web_services#country - it's $20 for 200,000 lookups which isn't bad value at all.

EDIT: MaxMind also do a service with resolution down to the city: http://www.maxmind.com/app/web_services#city. It's a bit more expensive at $20 for 50,000 queries but that still isn't too bad. I can't vouch for the accuracy of this service though as I have only used the country resolution one, as that's all we need.

Greg Beech
That's not REST, that's basically RPC over HTTP.
Jim
So the question specifically asked for REST or SOAP. That is neither.
Jim
Yawn. Whining about semantics doesn't help anybody. You can't built a REST-style service for this because the artefact (the country code) for a given URL is non-constant, so my assumption was that any web based service with a trivial to construct request would be sufficient.
Greg Beech
I'm not whining about semantics, I'm merely pointing out that somebody asked specifically for REST or SOAP, and this is neither. You can easily build a REST-style service for this, for example, you could treat IP addresses as resources, and the country they reside in as data within those resources.
Jim
I'd be really surprised if anybody except ivory tower purists were that bothered about whether the end of the URL is ?ip=80.192.33.20 or /80.192.33.20 - but if you feel that strongly about it then feel free to give the answer a negative vote. I prefer pragmatism.
Greg Beech
Look mate, I'm not saying REST is best. I'm not saying that you are a bad programmer. I'm not saying MaxMind is not useful. All I'm saying is that Jonathan asked for REST or SOAP, and that is neither. Quit being so over-sensitive. You're lashing out because I dared point out a problem? Grow up.
Jim
FYI, RPC over a querystring would suffice. I'd have preferred SOAP, as we have an existing SOAP logging and cacheing framework, but you take what you can get :)
FlySwat
A: 

There is http://countries.nerd.dk which provides country information by IP. How much resolution do you need?

Greg Hewgill
A: 

@Greg, Thanks for the recommendation, however we serve 2M unique per day, so I don't think an additional cost of $288k per year would help the geotargetting business case :)

FlySwat
+1  A: 

It's not a web service, but MaxMind also provide a free database that you can download. If you need a web service, then it would be trivial to set one up on your own server using this database. You can also get a site-license for a more accurate database if the free one isn't suitable.

Jim