Reputation: 1430
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)?
Upvotes: 4
Views: 4363
Reputation: 39884
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.
Upvotes: 3
Reputation: 1385
Assuming you are getting lat/long coordinates, then you could use something like SimpleGeo's services: http://simplegeo.com/
I think the Google option is better, SimpleGeo sounds like way more than you need.
Upvotes: 0