After googling, I found many solutions that don’t seem to work or require permission from the user.
Looking for something that is easy to use, PHP or Javascript, and does not require the user’s permission. It doesn’t need to be the most accurate.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Google Analytics is great for this (javascript).
EDIT:
Should point out that Google Analytics has an API to get City/Country info and all reporting info if you need to programmatically do something with it – http://code.google.com/apis/analytics/docs/
But if that’s not an option:
You can get a users ip with PHP’s
$_SERVER['REMOTE_ADDR']With that, you can use PHP’s GeoIP library to geolocate it: http://php.net/manual/en/book.geoip.php