package api.jisuapi.qqluck; 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/qqluck/query"; public static final String qq = "22222"; public static void Get() { String result = null; String url = URL + "?qq=" + qq + "&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 qq = resultarr.getString("qq"); 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( qq + " " + score + " " + luck + " " + content + " " + character + " " + characterdetail); } } catch (Exception e) { e.printStackTrace(); } } }