: How do websites such as Groupon or Zillow detect user location? I have noticed that Groupon.com or Zillow.com knows what city I am located in quite reliably and without asking permission. Does
I have noticed that Groupon.com or Zillow.com knows what city I am located in quite reliably and without asking permission.
Does anyone know what they or similar big players do to get your location? Are they using private ip-based databases or something else?
I need to know what city a user is in, are there any online services that I can use to get a user's location for free?
More posts by @Sherry384
1 Comments
Sorted by latest first Latest Oldest Best
They are most likely using geolocation by IP address or hostname.
There are many services that provide data for this. One that I know of that's easy to use is freegeoip.net. They have an API that you can call 10,000 times per hour to get geolocation data.
For example, if you make an HTTP GET request to freegeoip.net/json/stackoverlow.com, you can get data back in multiple formats. This example returns JSON:
{
"ip": "69.172.201.208",
"country_code": "US",
"country_name": "United States",
"region_code": "NY",
"region_name": "New York",
"city": "New York",
"zip_code": "10004",
"time_zone": "America/New_York",
"latitude": 40.689,
"longitude": -74.021,
"metro_code": 501
}
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.