asp代码获取微信用户位置坐标需要配合公众号使用,当用户打开这个页面时,会弹出是不是同意接受某某公众号获取你位置信息的对话框,同意后,该用户的坐标及位置就会被显示出来,你在入库就可以了。
<%
'转载请保留作者信息:18611436777
'尊重码农
key = “04f49e3370296eba2469d252c8a305bc”'高德地图api 申请地址:http://lbs.amap.com/
loca = Request(“lng”)&","&Request(“lat”)
'Response.Write(loca)
'Response.End()
url = “http://restapi.amap.com/v3/geocode/regeo?key="&key&"&location=”&loca
result = RequestUrl(url)
set j = getjson(result)
address = j.regeocode.formatted_address
Response.Write(address)
'Get方法请求url,获取请求内容
Private Function RequestUrl(url)
Set XmlObj = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
XmlObj.open "GET",url, false
XmlObj.send
If XmlObj.Readystate=4 Then
RequestUrl = XmlObj.responseText
Else
Response.Write("xmlhttp请求超时!")
Response.End()
End If
Set XmlObj = nothing
End Function
%>