|
|
@ -22,13 +22,16 @@ public class BaiduUtils { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static JSONObject ipLocation(String ip) { |
|
|
|
public static JSONObject ipLocation(String ip) { |
|
|
|
System.out.println(ip); |
|
|
|
System.out.println(ip); |
|
|
|
if (ip != null) { |
|
|
|
try { |
|
|
|
JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip); |
|
|
|
if (ip != null) { |
|
|
|
return response; |
|
|
|
JSONObject response = HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=" + ip); |
|
|
|
} else { |
|
|
|
return response; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|