google GeoLocation API调用请求
geolocation 定位可以基于ip, wifi和手机基站,示例是一个基于手机基站定位的例子请求POST /loc/json HTTP/1.1 Host: www.google.com Accept: */*Content-Type: application/jsonCache-Control: no-cachePragma: no-cacheUA-CPU: x86Accept-Encoding: gzip, deflateUser-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)Proxy-Connection: Keep-AliveHost: www.google.comContent-Length: 402{ "access_token" : "2:bQ-zHwG1xLdiP-sF:3li7KSH1OSqgYn1D", "host" : "code.google.com", "radio_type" : "unknown", "request_address" : true, "version" : "1.1.0","cell_towers": [ { "cell_id": "42", "location_area_code": 415, "mobile_country_code": 310, "mobile_network_code": 410, "age": 0, "signal_strength": -60, "timing_advance": 5555 } ] }
响应
HTTP/1.1 200 OKContent-Type: application/jsonDate: Wed, 29 Apr 2009 07:26:28 GMTExpires: Wed, 29 Apr 2009 07:26:28 GMTCache-Control: private, max-age=0X-Content-Type-Options: nosniffContent-Length: 262Server: GFE/2.0{"location":{"latitude":51.0,"longitude":-0.1,"address":{"country":"United Kingdom","country_code":"GB","region":"West Sussex","county":"Mid Sussex","city":"Haywards Heath","street":"Fairford Close","street_number":"12","postal_code":"RH16 3"},"accuracy":787.0}}
协议详情请参见:
http://code.google.com/apis/gears/geolocation_network_protocol.html
页:
[1]