package api.jisuapi.lsplateluck; import java.net.URLEncoder; import api.util.HttpUtil; import net.sf.json.JSONObject; public class Query { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/lsplateluck/query"; public static final String lsplate = "浙A11111";// utf-8 public static void Get() throws Exception { String result = null; String url = URL + "?lsplate=" + URLEncoder.encode(lsplate, "utf-8") + "&appkey=" + APPKEY; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = json.optJSONObject("result"); String lsplate = resultarr.getString("lsplate"); String city = resultarr.getString("city"); String province = resultarr.getString("province"); String score = resultarr.getString("score"); String luck = resultarr.getString("luck"); String content = resultarr.getString("content"); String character = resultarr.getString("character"); String characterdetail = resultarr.getString("characterdetail"); System.out.println(lsplate + " " + province + " " + city + " " + score + " " + luck + " " + content + " " + character + " " + characterdetail); } } catch (Exception e) { e.printStackTrace(); } } }