Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to check that people who registrates in my site and check in country box , for example, Argentina is really living in Argentina. How can I make sure that people is really living in that country and not access to my site via proxy or VPN?

share|improve this question
Here is a relevent question on SO:… – WalterJ89 Mar 5 '12 at 6:06
I don't think you can based on the IP address. For example there is the Tor project ( Although you can't control which IP address is used, each user can prevent you from detecting their geographical location when they go through the Tor network. – Manfred Mar 5 '12 at 6:50
Why do you need to ask them where they live, if you can detect it anyway? – user1249 Mar 5 '12 at 7:17
@John: I think the point is he wants to make sure people aren't using Tor or a proxy or something. Although, if you're using a Proxy/VPN what's to stop you just putting the country your proxy is in? – Dean Harding Mar 5 '12 at 8:30
up vote 9 down vote accepted

There's no way to guarantee where a person is based on their IP address. You can get a reasonable guess from GeoIP info. But you cannot ever really be sure. You can mess around with headers trying to guess if a proxy is being used, but headers might not always be there.

So, unless you have some legal reason to do this (for example, hosting content you're only licensed to make available in certain countries), or just want to annoy potential users who might be surfing via their company's VPN or remote desktop that happens to be hosted outside the country, I wouldnt even waste my time with it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.