HOW TO: Display Visitor's Location In Browser

Discussion in 'Programming' started by j0563, Mar 11, 2009.

  1. #1
    I am trying to find out how to display a visitor's CITY in their browser when they visit my site. For example: Miami, Florida

    I am NOT looking at how to display their IP address, but their location.

    For example, look at: http://www.tracemyip.org/

    Under the heading "Hub City" it shows your city. How do I do that on my site?
     
    j0563, Mar 11, 2009 IP
  2. spyka

    spyka Greenhorn

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    It'll depend what language you have to/can use

    You could look at http://www.maxmind.com/app/php for PHP

    But I will say it isn't 100% correct, that site you link to for example says I am from London, over 500 miles from me :D
     
    spyka, Mar 11, 2009 IP
  3. REALLY Made IN Canada

    REALLY Made IN Canada Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    MaxMind Geo-IP is a good tool, but keep in mind that it does pull down the server while it converts the visitor's IP address to a country/city, and some ISPs yield silly results.

    For example, AOL surfers in Canada, may appear as being in the US because of how the ISP is set up. Some more expensive GEO-IP databases can deal with issues like this.

    But, the "I see you're in (CITY)" web gadget is pretty much a useless cliche right now on the Internet and it's not worth the cost in most cases.
     
    REALLY Made IN Canada, Mar 15, 2009 IP
  4. alexpr07

    alexpr07 Active Member

    Messages:
    284
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #4
    In order to display visitor's city you need to have the database that contains ranges of IPs and corresponding Countries, States, Cities.
    Someone recommended to use MaxMind but I never tried it so can't help you here... In any case, you need to get visitor's IP, convert it to a number and then look it up in your database to get corresponding city. Try to search for this database on google, there should be some free ones but they might not be so accurate...
    Good luck!
     
    alexpr07, Mar 15, 2009 IP