Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2008
    Rep Power

    Post IPAddress to Country

    How to know the Country from the IPAddress?

    I want to know from which country is the client logging into my website, is there any process to do so. I think it is possible to know it from the IPAddress, but I don't know how to get started.. please help... :)

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    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

  3. #3
    neilcoffey is offline Senior 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).

Similar Threads

  1. IPAddress or HostName
    By abhijeet_152 in forum Networking
    Replies: 1
    Last Post: 11-27-2008, 07:58 PM
  2. Replies: 2
    Last Post: 08-27-2008, 02:40 PM
  3. How to track client logout time and orignal ipaddress (not gateway) in java
    By psandeep in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 06-13-2008, 12:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts