|All requests||>||Detect user's location at the street ...||>||Request new recommendation||>||Featured requests||>||No recommendations|
by PHP5Matters - 8 years ago (2015-08-04)
1. by Manuel Lemos - 8 years ago (2015-08-04) Reply
There some solutions for that in PHP, some require calling a remote API, others require searching a database file of IP address ranges.
There are free solutions for each but the most accurate and up to date are paid.
2. by Dave Smith - 8 years ago (2015-08-04) in reply to comment 1 by Manuel Lemos Comment
And I do not know of any that get down to the street level.
3. by Manuel Lemos - 8 years ago (2015-08-05) in reply to comment 2 by Dave Smith Comment
Yes, from the IP address you cannot get much more accuracy than city level and even at that level many API may be very inaccurate.
What you can do is check if the support of the HTML5 geolocation is enabled. If so, you can get the approximate coordinates from your device GPS or whatever your browser supports.
Then you can call the Google Maps API for instance to a more accurate location at least near the street level.
the precision at the street level only depending of latitude and longitude i suggest this package which is above all a very simple way without special programmer's knowledge to , include a ip location feature in your app.Of course you can use ajax to request a PHP script using this package...
It will not work if the user device cannot figure its location or the user does not allow to share his location, but otherwise it is still useful.