Reputation: 923
I'm making a website and I need to register the user's ip to make a sort of "geolocation" by longitude and latitude through the ip address.
Actually I'm using the geoip library of php with maxmind geoipcity.dat (http://php.net/manual/en/book.geoip.php). I saw that for the 60/70% this method doesn't work, I mean that it doesn't found the longitude and latitude and city, but only the country.
I don't want use third services, as I wrote in the topic title. Maybe you can give me some suggestion or something that I didn't found on the web.
Thank you for the replies!
Upvotes: 0
Views: 1487
Reputation: 1457
Unless you can access to the end user GPS data, then you must use a third party service to translate IP address or WIFI MAC address to latitude and longitude.
Below are 2 proposal to solve your problem.
Request end user to share their GPS location through HTML 5. In this case, web browser will request authorization from end user before sharing the coordinates to you (subject to availability). You can visit http://ipgeo5.com for sample codes.
Change another geolocation database. If coverage is your concern, you can evaluate other database providers. You can visit http://lite.ip2location.com and use their IP2Location LITE database and see if it meet your requirements.
Upvotes: 1