views:

63

answers:

5

Hi I wish to track a user's country from where my website is accesed . ex; if a customer from a particular is accessing say america how to trace that the user is actually from america. Is there any way

+3  A: 

What you are talking about is called GeoIP and there are many ways to do it. Normally this is done using a third party that has a mapping of IP addresses to physical locations.

This is of course not 100% accurate, as people may be using VPNs, TOR or simply spoofing addresses.

Oded
Or they may be from a multinational organization that does not publish how its IP range is divided between its branches.
Michael Borgwardt
+3  A: 

It's not possible in all cases, but most IP addresses can be mapped to a location (even down to the city). There are quite a large number of such geomapping services.

Michael Borgwardt
A: 

here is a question on SO about getting the country from IP address. This link talk about getting the IP address form the request.

devcoder
+1  A: 

Use MaxMind service. http://www.maxmind.com/app/javascript_city They got free and paid versions.

Codler
+1  A: 
Will