I'm hoping you guys can help me figure out a way to determine a user's city or county (99.9% of our traffic is in the US). I'm sure that it can be done, since Google Analytics breaks down my traffic by city, but I can't figure out how to do it myself.
I tried using ipinfodb.com, but it's really not accurate for my area; I'm in western NC, but it lists me in Ohio. WHOIS for my IP shows that it's registered in Florida, so that's no good, either.
HTML5 Geolocation also misses me by about 200 miles, so that's pretty useless for my needs.
As a sort of last-ditch-effort, I'm searching the hostname for each county's name manually, in the hopes that their IP provider has the county's name. That only catches 1 in 10 users, though ("Embarq" and "Time Warner Cable" are big providers, and don't have the county name in the hostname), so it helps, but not a lot.
Any other suggestions? I'm willing to pay for a database, but I'd rather roll my own script.