高德地图查询结果返回INVALID_USER_IP错误解决
高德地图查询结果返回INVALID_USER_IP错误解决
方法是添加白名单。IP白名单出错,发送请求的服务器IP不在IP白名单内
开发者在LBS官网控制台设置的IP白名单不正确。白名单中未添加对应服务器的出口IP。可到"控制台>配置" 中设定IP白名单。
提供的IP是公网IP.
请求地址:(密钥串替换成申请的Key)
http://restapi.amap.com/v3/geocode/regeo?output=json&location=121.429462,31.153127&key=密钥串&extensions=base
查询返回结果:
{"status":"1","regeocode":{"addressComponent":{"city":[],"province":"上海市","adcode":"310104","district":"徐汇区","towncode":"310104017000","streetNumber":{"number":"9001号","location":"121.429462,31.153127","direction":"Center","distance":"0","street":"沪闵路"},"country":"中国","township":"漕河泾街道","businessAreas":[{"location":"121.416403,31.167910","name":"漕河泾","id":"310104"},{"location":"121.447517,31.173178","name":"龙华","id":"310104"},{"location":"121.419562,31.156037","name":"康健","id":"310104"}],"building":{"name":"上海南站","type":"交通设施服务;火车站;火车站"},"neighborhood":{"name":[],"type":[]},"citycode":"021"},"formatted_address":"上海市徐汇区漕河泾街道上海南站"},"info":"OK","infocode":"10000"}
错误码说明:
https://lbs.amap.com/api/webservice/guide/tools/info