首页 QQ号码测吉凶 QQ号码测吉凶示例代码 QQ号码测吉凶 [Java]

QQ号码测吉凶 示例代码[Java]

作者:xiezhongpian 阅读数:1756 上传时间:2017-05-09

QQ号码测吉凶

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();
		}
	}
}