What most accurately determines the location.
The http://www.maxmind.com/ free API will take you to the country and city level for some IP addresses, if you pay them, you can get more detailed information, this information is a good default, but not 100% accurate. This is the best I have found.
Here is a completely free web service
http://www.hostip.info/
I used IP2Location before and it works great. The free version will return the country, but paid versions are very accurate and will return much more information. They have an API for many common languages.
The PECL Geo IP package and the Net_GeoIP PEAR package provide an interface for the maxmind location database (which was mentioned in other answers) for PHP.