craigslist如何获得位置[重复]

Possible Duplicate:
free geolocation geoip, are they viable?

I would like to find the most precise method of tracking a visitor's location. I noticed that craigslist can accurately get the user's location without requiring any input from the user. Can anyone tell me what they are doing in order to track the user? I'd like my web programs to be just as accurate as theirs.

note: (I've been using JavaScript / PHP. )

They are almost certainly using a GeoIP database or web service of some kind. The most well known company offering these services is probably MaxMind.

MaxMind offered free and less accurate version of their database last time I checked, and there are other providers offering free databases as well (none of which I can personally vouch for). There is a discussion about these free alternatives.

PHP has a module which can be used with a GeoIP database like those supplied by MaxMind.

Mybe you would like to use this

<script type="text/javascript" src="http://j.maxmind.com/app/geoip.js"></script>