Results 1 to 3 of 3
Thread: IPAddress to Country
- 12-18-2008, 01:43 PM #1Member
- Join Date
- Jan 2008
- Rep Power
- 12-18-2008, 09:31 PM #2
There are databases and services that can get it sort of correct. But its impossible to get it correct.
I worked for a multi-national company, and all of the computers in Dusseldorf, Germany, had IP addresses that were from the HQ located in Virginia, USA.
Google for IP geolocation
- 12-19-2008, 01:39 AM #3Senior Member
- Join Date
- Nov 2008
- Rep Power
The most accurate way is to reference a pre-built database as @fishtoprecords says. Technically, you can often get the country information from the WHOIS database, but you're "not supposed to" for marketing purposes.
In practice, existing databases take their data from a variety of "clues":
- the WHOIS database (yes, naughtily, I'm fairly sure it is used -- look for IP addresses registered with British Telecom (BT) which the database mysteriously thinks is from the country of Bhutan)
- routing infomation -- looking to see if tracing to particular IPs passes through certain routers that are obviously in a particular country
- partnering with web sites that take user information and just ask the user what country they're in then associate it with their IP address
Another approach that is less accurate but doesn't require a database is to just look at the country of the search engine from which the user got to your site. I put together a page a while back on geolocation from the referer string, with examples of specific regular expressions that work with the main search engines. A surprising number of users actually are quite patriotic and use a search engine for their country. In a few cases, this approach actually distinguishes better than some databases, which have trouble with companies using routers across each other's borders (AOL connections in the UK/France were reckoned to be a particular problem at one point I seem to recall).Neil Coffey
Javamex - Java tutorials and performance info
- By abhijeet_152 in forum NetworkingReplies: 1Last Post: 11-27-2008, 06:58 PM
- By shadab in forum AWT / SwingReplies: 2Last Post: 08-27-2008, 02:40 PM
- By psandeep in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 06-13-2008, 12:32 AM