Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I accurately determine the location of a visitor to my website?

I need a consistent and reliable way to determine the location (state/province, country, etc) of a computer that visits my website, using any of the following:

  • PHP
  • JavaScript
  • MySQL
  • Any Web Services
  • Something I haven't thought of?

I'm am not looking for a locked-out 3rd party stats program such as Google Analytics. It's already in use and does amazing stuff, however I need code level access to the information.

The ideal solution should allow me to provide whatever information is required (such as an ip address) and accurately obtain as much information as I can about the visit. Obtaining the country of origin is a minimum requirement however extras such as states, latitude and longitude, city, etc would be nice.

Clarification: I need to be able to use the information regularly in PHP code. Not just view it somewhere.

like image 906
Paulo Avatar asked Feb 26 '09 17:02

Paulo


1 Answers

It's called "geolocation", and it's been covered before.

like image 182
Jim Puls Avatar answered Sep 28 '22 05:09

Jim Puls