How to find out the GPS coordinates of a user who logged in from a computer?

I want to show the user’s location on the site (php). How can I get the most accurate coordinates?


Answer 1, authority 100%

Ask the user to enter their coordinates 🙂 In general, there is such a thing for this as IP GeoLocation. Dig for this keyword. But keep in mind that the data obtained in this way is not accurate and may not correspond to reality at all.

Also, some browsers are able to provide such data.. and again the GeoLocation keyword. For example, geo-location-javascript. Again, there are no guarantees of accuracy.


Answer 2, authority 50%

In the presentation on HTML5 on the website of these guys:
http://www.html5rocks.com/en/
I saw an html5 component that shows your current location, by ip, of course, look at how the component is made or use this component yourself, there is also information on adapting the code for browsers, but it is likely that this particular component will work in all browsers.

There is another option to use the Google Maps API or Yandex Maps API
The scheme is simple:
1) The user enters his address, country there, city, etc., (or selects the address from the drop-down menus)
2) The map can show where this place is, and the map can also give you the GeoCoordinates of the point, which, as far as I know, corresponds to gps coordinates.