Have you ever thought about using a geoip service, like http://www.telize.com/ it offers a API with http://www.telize.com/geoip?callback=getgeoip