Forum Moderators: DixonJones

Message Too Old, No Replies

Getting the ISP and location

         

Kronos

7:12 pm on Jul 28, 2003 (gmt 0)

10+ Year Member



Hey everyone,

I'm trying to get a visitor's Internet Service Provider and, from that, his geographical location (his country only). Anyone know of a way to do that in Javascript or PHP? Thanks!

adamas

12:12 pm on Jul 29, 2003 (gmt 0)

10+ Year Member



I believe the phrase is 'geographical ip targetting'

Try a google search for geoip and go from there. I'm currently using the free version of what was the number one position when I did the search. Haven't tried the paid version or any other geo ip targetting software.

Sculli

1:38 pm on Jul 31, 2003 (gmt 0)



Hi Kronos
I am using AWstats and it does geographical IP location with a nice graphical display and national flags. Many IPs are stated to be unknown origin, though and
I wonder however why so many of our customers come from the Ascension Islands....
Probably but a lone Router or something....
Cheers
Sculli

sabai

6:01 pm on Aug 3, 2003 (gmt 0)

10+ Year Member



You can download a list of IP ranges -> countries at [ip-to-country.directi.com ] - throw it into a database and you have a very effective & fast geoip tool. They did a HTTP GET based service for a while, but it got swamped so they pulled it.

Failing that, you can check the 'Accept-Language' in the request header. Usually it is 'en-us', 'en-gb', 'fr' or whatever and can be a good indicator of location. Of course, it may be set incorrectly or could be a US laptop in France or something. Also, it might just be set to 'en', but it is quick and easy and requires very little work to get. You can get it easilly with

$_SERVER["HTTP_ACCEPT_LANGUAGE"]
in PHP.

have fun...