Forum OpenACS Q&A: Identify Country where you are surfing from via IP address

Hello All,

We have a client that would like the certain elements of the website
to change based on where our visitor is surfing from.

We are trying to find out if this is possible to do by identifying the
place where the user is surfing from by using IP addresses. It is
basically between domestic users and international users. So what I
intend to do is get a list of IP addresses that are allocated to our
country and use that as a basis for lookup.

So everytime the user logs in we would compare the ip address with
that of the ip addresses in the lookup table. If there's a match then
the user is a local user otherwise the user is an international user.

My question is whether any body has done something like this before
and whether there's another more reliable way of doing this -  short
of actually asking the user where they're coming from.

Many Thanks

Several years ago, it was reported in the news that some organization had "mapped the entire Internet" -- i.e. they had mapped IPs to geographical locations. I don't remember the organization that originally did this, but there are several Internet mapping projects.

http://research.lumeta.com/ches/map/index.html would be a good place to look -- this Internet mapping project's site has several links to other projects (also try http://www.cybergeography.org).

http://www.networldmap.com/TryIt.htm -- a working online example that identifies your geo location based on your IP
Google claims to be able to do this with 99% accuracy if you want to target ads at users in particular countries: https:// adwords.google.com/AdWords/faq.html#country. I don't know the methodology, though.
However, in some cases it's not possible to geocode from an IP
address.

For example, I have a 2-way satellite link with a static IP address
in my motorhome. Other than narrowing it down to the western
hemishere if you tracerouted the IP there's no way to know
where that IP actually resides. You could guess it's in the U.S.
but it could also be in Canada or Mexico.

A more common example would be folks accessing the net
through corporate proxy servers or via VPN connections.

I know old cgi scripts would use the suffix of a visitor's net address. So someone surfing with a .co.uk address would most likely be in the uk, .co.za in South Africa...

Not totally accurate, but reasonably so, and easier/cheaper to implement.

Check out arin http://www.arin.net/cgi-bin/whois.pl
For example I search on my ip 204.101.53.222 - it gives back

WorldLinx Telecommunications
RADIANT Communications - > my service provider
Toronto, Ontario M5V 3G1
So basically you can get my location. I guessing thats how google does it. Probably they replicate the data. I wrote a little script in python that can get the data via a post command. Doing the same thing in tcl should be easy.


Anthony

Another option I just heard about:

http://www.maxmind.com/app/free