首页 银行卡归属地查询 银行卡归属地查询示例代码 银行卡归属地查询[Java]

银行卡归属地查询示例代码[Java]

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

银行卡归属地查询

package api.jisuapi.bankcard;

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/bankcard/query";
	public static final String bankcard = "6212261202011584349";// 银行卡号

	public static void Get() {
		String result = null;
		String url = URL + "?appkey=" + APPKEY + "&bankcard=" + bankcard;

		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 bankcard = resultarr.getString("bankcard");
				String name = resultarr.getString("name");
				String province = resultarr.getString("province");
				String city = resultarr.getString("city");
				String type = resultarr.getString("type");
				String len = resultarr.getString("len");
				String bank = resultarr.getString("bank");
				String logo = resultarr.getString("logo");
				String tel = resultarr.getString("tel");
				String website = resultarr.getString("website");
				String iscorrect = resultarr.getString("iscorrect");
				System.out.println(bankcard + " " + name + " " + province + " " + city + " " + type + " " + len + " "
						+ bank + " " + logo + " " + tel + " " + website + " " + iscorrect);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}