package api.jisuapi.creditblacklist; import java.net.URLEncoder; import api.util.HttpUtil; import net.sf.json.JSONArray; 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/creditblacklist/query"; public static final String realname = "杨某新"; public static final String idcard = "4112211977011114521"; public static void Get() throws Exception { String result = null; String url = URL + "?realname=" + URLEncoder.encode(realname,"utf-8") + "&idcard=" + idcard + "&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 realname = resultarr.getString("realname"); String idcard = resultarr.getString("idcard"); System.out.println(realname + " " + idcard); if (resultarr.opt("list") != null) { JSONArray list = resultarr.optJSONArray("list"); for (int i = 0; i < list.size(); i++) { JSONObject obj = (JSONObject) list.opt(i); String age = obj.getString("age"); String sex = obj.getString("sex"); String idcard1 = obj.getString("idcard"); String filingdate = obj.getString("filingdate"); String caseno = obj.getString("caseno"); String baseonno = obj.getString("baseonno"); String baseonorg = obj.getString("baseonorg"); String court = obj.getString("court"); String province = obj.getString("province"); String duty = obj.getString("duty"); String performance = obj.getString("performance"); String description = obj.getString("description"); String pubdate = obj.getString("pubdate"); System.out.println(age + " " + sex + " " + idcard1 + " " + filingdate + " " + caseno + " " + baseonno + " " + baseonorg + " " + court + " " + province + " " + duty + " " + performance + " " + description + " " + pubdate); } } } } catch (Exception e) { e.printStackTrace(); } } }