[thelist] Country by IP address

Carl Meyer cjmeyer at npcc.net
Sun Jun 27 19:44:44 CDT 2004


hi Andy,

On Tue, 15 Jun 2004, Andy Budd wrote:
> I'm basically looking for some hints on how to write a simple php 
> script (as I'm not a very good php programmer) to examine the IP 
> address of a site visitor and guesstimate the visitors country by using 
> a mySQL db lookup. It's for my personal site so I'm not really 
> interested in any paid services.

Just to throw out another angle, it is possible to query IP addresses for
their owner at http://ws.arin.net/cgi-bin/whois.pl.  If you query an IP
address, then click on the address block, it gives you a bunch of data about
the owner, including country.  You _could_ automate this query from PHP
(technically speaking), but it would be quite slow, and I'm sure arin.net
would not appreciate it if you have much volume at all.  So I don't really
recommend this route for your situation.

Carl



More information about the thelist mailing list