package api.jisuapi.cell;
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/cell/query";
public static final String mnc = "0";// 0移动 1联通
public static final String lac = "22709";
public static final String cellid = "39205";
public static final String sid = "";// 电信填写
public static final String nid = "";// 电信填写
public static void Get() {
String result = null;
String url = URL + "?appkey=" + APPKEY + "&mnc=" + mnc + "&lac=" + lac + "&cellid=" + cellid + "&sid=" + sid
+ "&nid=" + nid;
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 lat = resultarr.getString("lat");
String lng = resultarr.getString("lng");
String addr = resultarr.getString("addr");
String accuracy = resultarr.getString("accuracy");
System.out.println(lat + " " + lng + " " + addr + " " + accuracy);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}