http get / post请求和google geolocation api

时间:2022-08-22 19:29:49

I'm using the web application at http://m.rummble.com website and when I click find my location using gears. The application returns my current location (approximate city location) with various establishments in a given mile radius. To further understand how this works, I opened up wireshark and what I notice is that a POST request is sent to www.google.com/loc/json. Then the google server responds with 200 OK and location data in JSON format. I understand this part. The next step is what I don't understand. Apparently after the rummble application receives the location data (lat, long, address, etc.) it sends this information using a GET request to some api on another server that acquires the various establishments in a given mile radius. All I did was click, find my location using gears. I would reasonably expect the application to just return my location but it's returning more than that without clicking any other buttons in the application. Can someone explain how this happens? Is there a script that makes this happen? I hope I explained my situation better.
alt text http://img211.imageshack.us/img211/1236/examplel.jpg

我在http://m.rummble.com网站上使用网络应用程序,当我点击使用齿轮找到我的位置时。该应用程序返回我在当前半径范围内的各种场所的当前位置(大致的城市位置)。为了进一步了解其工作原理,我打开了wireshark,我注意到POST请求已发送到www.google.com/loc/json。然后谷歌服务器响应200 OK和JSON格式的位置数据。我理解这一部分。下一步是我不明白的。显然,在朗姆酒应用程序接收到位置数据(纬度,长度,地址等)之后,它使用GET请求将该信息发送到另一个服务器上的api,该服务器获取给定英里半径内的各种机构。我所做的只是点击,使用齿轮找到我的位置。我会合理地期望应用程序只返回我的位置,但它返回的不仅仅是没有单击应用程序中的任何其他按钮。有人可以解释这是怎么发生的吗有没有一个脚本可以实现这一目标?我希望我能更好地解释我的情况。 alt text http://img211.imageshack.us/img211/1236/examplel.jpg

2 个解决方案

#1


Well, the first step in determining an anonymous user's location, is by his IP. If that's what you want, you need to do one of two things:

那么,确定匿名用户位置的第一步是通过他的IP。如果这是你想要的,你需要做两件事之一:

  1. Find a database of IP-and-locations. A quick Google search turned up http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip
  2. 查找IP和位置数据库。一个快速的谷歌搜索出现了http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip

  3. Trace route and reverse-lookup the IPs to host names using DNS, and try to read the host names for geo-information, such as country and city.
  4. 跟踪路由并使用DNS反向查找IP到主机名,并尝试读取地理信息的主机名,例如国家和城市。

Either way, once you have a country and/or city, you can do a lookup geo-lookup to find latitude and longitude, and display a map based on those coordinates.

无论哪种方式,一旦您拥有国家/地区和/或城市,您就可以执行查找地理查找以查找纬度和经度,并根据这些坐标显示地图。

Presumably, Google Gears uses something similar, or perhaps based on data mass-collected by Google using their various data-collection techniques. That way, once Google Gears has figured out where the user is, it knows which city/country he's in, and requests the matching latitude and longitude.

据推测,Google Gears使用类似的东西,或者可能基于Google使用各种数据收集技术收集的数据。这样,一旦Google Gears确定了用户所在的位置,就会知道他所在的城市/国家/地区,并请求匹配的纬度和经度。

#2


For whatever reason, rummble.com isn't querying navigator.getlocation on my machine, so I can't confirm your report myself.

无论出于何种原因,rummble.com都没有在我的机器上查询navigator.getlocation,所以我无法自己确认你的报告。

However, when you click to allow rummble.com to get your location from Gears, you're handing over that location information to the rummble.com website. That website is then free to do with it as it wants -- the information is returned to a piece of Javascript running on the browser, and in this case it sounds like that piece of Javascript is using your location information to load a list of nearby restaurants.

但是,当您点击允许rummble.com从Gears获取您的位置时,您将该位置信息移交给rummble.com网站。然后该网站可以随意使用它 - 信息将返回到浏览器上运行的一段Javascript,在这种情况下,听起来好像Javascript正在使用您的位置信息来加载附近的列表餐厅。

You might very reasonably be worried about this. What if rummble were sending your name and location information to an advertiser or to the government? How long are they storing your precise location information? You should consider these implications before giving permission to share your location with a website.

你可能会非常担心这一点。如果谣言将您的姓名和位置信息发送给广告商或*,该怎么办?他们存储您的精确位置信息多久了?在允许与网站共享您的位置之前,您应该考虑这些影响。

#1


Well, the first step in determining an anonymous user's location, is by his IP. If that's what you want, you need to do one of two things:

那么,确定匿名用户位置的第一步是通过他的IP。如果这是你想要的,你需要做两件事之一:

  1. Find a database of IP-and-locations. A quick Google search turned up http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip
  2. 查找IP和位置数据库。一个快速的谷歌搜索出现了http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip

  3. Trace route and reverse-lookup the IPs to host names using DNS, and try to read the host names for geo-information, such as country and city.
  4. 跟踪路由并使用DNS反向查找IP到主机名,并尝试读取地理信息的主机名,例如国家和城市。

Either way, once you have a country and/or city, you can do a lookup geo-lookup to find latitude and longitude, and display a map based on those coordinates.

无论哪种方式,一旦您拥有国家/地区和/或城市,您就可以执行查找地理查找以查找纬度和经度,并根据这些坐标显示地图。

Presumably, Google Gears uses something similar, or perhaps based on data mass-collected by Google using their various data-collection techniques. That way, once Google Gears has figured out where the user is, it knows which city/country he's in, and requests the matching latitude and longitude.

据推测,Google Gears使用类似的东西,或者可能基于Google使用各种数据收集技术收集的数据。这样,一旦Google Gears确定了用户所在的位置,就会知道他所在的城市/国家/地区,并请求匹配的纬度和经度。

#2


For whatever reason, rummble.com isn't querying navigator.getlocation on my machine, so I can't confirm your report myself.

无论出于何种原因,rummble.com都没有在我的机器上查询navigator.getlocation,所以我无法自己确认你的报告。

However, when you click to allow rummble.com to get your location from Gears, you're handing over that location information to the rummble.com website. That website is then free to do with it as it wants -- the information is returned to a piece of Javascript running on the browser, and in this case it sounds like that piece of Javascript is using your location information to load a list of nearby restaurants.

但是,当您点击允许rummble.com从Gears获取您的位置时,您将该位置信息移交给rummble.com网站。然后该网站可以随意使用它 - 信息将返回到浏览器上运行的一段Javascript,在这种情况下,听起来好像Javascript正在使用您的位置信息来加载附近的列表餐厅。

You might very reasonably be worried about this. What if rummble were sending your name and location information to an advertiser or to the government? How long are they storing your precise location information? You should consider these implications before giving permission to share your location with a website.

你可能会非常担心这一点。如果谣言将您的姓名和位置信息发送给广告商或*,该怎么办?他们存储您的精确位置信息多久了?在允许与网站共享您的位置之前,您应该考虑这些影响。