高德地圖查詢結果返回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