I have a script to get a user's coordinates when they go to a certain page, but I need a way to get their approximate location (city, state, country, etc.). Is there a way I go about doing this server-side (preferrably PHP)?
Check out Google Maps' Reverse Geocoding API.
Choices that I have found till now
All of these expose simple HTTP endpoints for retrieving the address depending on a particular lat/lng combination.
You can also download the geonames database and use PostGIS or MySQL's spatial extension to build your own service. Advantage is that you won't have to worry about rate limits. Disadvantage is that it won't be very accurate.
SimpleGeo does not have any rate limits but the database is limited to the US the last time I checked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With