[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Mapping IP address to country

Krishna Srinivasan forced the electrons to say:
> I Would like to track the users that visit my website.

The easiest and nicest method would be to ask them. ;-) Have a form on
your website and state statistical reasons for collecting the info. Many
people don't like it if you try to track them.

> The IP address is got using $REMOTE_ADDR in PHP.
> Now how do I map this to the country of origin.

You could do a whois lookup and try to parse the o/p of all the whois
servers out there, but I would recommend against it. The tremendous
additional traffic that this would generate would probably affect the
performance of your server. Apache also has an option that enables reverse
DNS lookups on client IP addresses, but is turned off by default because
of performance reasons.

If you still insist, BW whois (http://bw.org/whois) is the right whois
client for this. But please remember that you are invading the privacy
of the surfer - I, for one, have just made a mental note never to visit
www.multimediastudio.com or recommend the site.