<?php
require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$idcard = '41272519800102067x';
$url = "https://api.binstd.com/idcard/query?appkey=$appkey&idcard=$idcard";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
echo $jsonarr['msg'];
exit();
}
$result = $jsonarr['result'];
echo $result['province'].' '.$result['city'].' '.$result['town'].' '.$result['sex'].' '.$result['birth'].' '.$result['lastflag'];
#!/usr/bin/python
# encoding:utf-8
import urllib2, json, urllib
# 1、身份证查询
data = {}
data["appkey"] = "your_appkey_here"
data["idcard"] = "41272519800102067x"
url_values = urllib.urlencode(data)
url = "https://api.binstd.com/idcard/query" + "?" + url_values
request = urllib2.Request(url)
result = urllib2.urlopen(request)
jsonarr = json.loads(result.read())
if jsonarr["status"] != u"0":
print jsonarr["msg"]
exit()
result = jsonarr["result"]
print result["province"],result["city"],result["town"],result["sex"],result["birth"],result["lastflag"]
package api.binstd.idcard;
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.binstd.com/idcard/query";
public static final String idcard = "41272519800102067x";
public static void Get() {
String result = null;
String url = URL + "?appkey=" + APPKEY + "&idcard=" + idcard;
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 province = resultarr.getString("province");
String city = resultarr.getString("city");
String town = resultarr.getString("town");
String lastflag = resultarr.getString("lastflag");
String sex = resultarr.getString("sex");
String birth = resultarr.getString("birth");
System.out.println(province + " " + city + " " + town + " " + lastflag + " " + sex + " " + birth);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}