免费身份证号码(免费身份证号码使用 实名认证)

前段时间有很多朋友都想知道免费身份证号码是什么。今天小编特意为大家整理了相关知识来解答!还有其他网友想搞清楚免费身份证号码使用 实名认证,币侠网小编(www.yfhhf.com)现在为大家找到了相关问题的答案,接下来一起看看吧,希望能给大家带来帮助。

接口描述

功能描述:由份证号码查询获取身份证的出生日期、性别、签发地区等信息。

URL 示例

1)http 协议:

POST 方式请求:http://cha.ebaitian.cn/api/json?appid=xxx&module=getIDCardInfo&idcard=xxx&sign=xxx

GET 方式请求:http://cha.ebaitian.cn/api/json?type=get&appid=xxx&module=getIDCardInfo&idcard=xxx&sign=xxx

2)https 协议:

POST 方式请求:https://cha.ebaitian.cn/api/json?appid=xxx&module=getIDCardInfo&idcard=xxx&sign=xxx

GET 方式请求:https://cha.ebaitian.cn/api/json?type=get&appid=xxx&module=getIDCardInfo&idcard=xxx&sign=xxx

请求参数

数据包体

{"type": "get","appid": "1000xxxx","module": "getIDCardInfo","idcard": "420101199001010000","sign": "ecab4881ee80ad3d76bb1da68387428ca752eb885e52621a3129dcf4d9bc4fd4"}

参数说明

参数必选类型描述

type否string授权接口的请求方式

appid是string授权接口的 AppID,请填写您在我要查官网上申请到的 AppID

module是string目标请求的数据模块,查询身份证号码为:getIDCardInfo

idcard是string目标要查询的身份证号码,仅支持18位二代身份证号码

sign是string请求凭证,具体计算方式见下面的其他说明

其他说明

1)type:可选值 get,如果赋值 get,则以 get 方式提交数据;默认以 post 方式提交数据;

2)sign:签名校验,根据公式 $sign=sha256(appid=$appid&module=getIDCardInfo&idcard=$idcard&appkey=$appkey) 生成;其中:appkey 为授权接口的 AppKey,请填写您在我要查官网上申请到的 AppKey 。

构造伪代码如下:

string type="get"; //请求方式,可以赋值为:poststring appid="1000xxxx"; //sdkappid 对应的 appid,需要业务方高度保密string module="getIDCardInfo"; //请求的数据模块,此处赋值:getIDCardInfostring idcard="420101199001010000"; //要查询的身份证号码,注意仅支持18位二代身份证号码string sign=sha256(appid=1000xxxx&module=getIDCardInfo&idcard=420101199001010000&appkey=56cf61af4b7897e704f67deb88ae8f24);

响应参数

数据包体

{"result":1,"description":"TRUE","flag":"","idcardInfo":{"birthday":"1996年02月01日","sex":"女","province":"湖北省","city":"武汉市","dis":"东西湖区","note":null}}

参数说明

参数必选类型描述

result是string接口响应结果:0-失败;1-成功

description是string接口响应描述:一般为 TURE(result=1) 与 FALSE(result=0),或者返回错误信息

flag否string错误说明,没有错误则返回空

idcardInfo是object返回身份证信息

idcardInfo 参数说明:

参数必选类型描述

birthday是string出生日期

sex是string性别

province是string发证地区,省(市/自治区)

city是string发证地区,市(区/自治州)

dis是string发证地区,区(县/市/区)

note否string其他备注信息,一般为空

SDK 及代码示例

PHP SDK

方法一:以 POST 方式请求数据

//接口参数$api_url='http://cha.ebaitian.cn/api/json';$api_appid='1000xxxx';$api_appkey='56cf61af4b7897e704f67deb88ae8f24';//函数,以POST方式提交数据,PHP需要开启CURL函数;数据传输安全,建议使用function getIDCardInfo($idcard){global $api_url,$api_appid,$api_appkey;$posturl=$api_url;$data='appid='.$api_appid.'&module=getIDCardInfo&idcard='.$idcard;$sign=hash("sha256",$data.'&appkey='.$api_appkey);$postdata=array("appid"=>$api_appid,"appkey"=>$api_appkey,"module"=>"getIDCardInfo","idcard"=>$idcard,'sign'=>$sign);$curl=curl_init();curl_setopt($curl, CURLOPT_URL, $posturl);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_POST, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);$output=curl_exec($curl);curl_close($curl);$obj=json_decode($output);$result=$obj->result;if($result==1){$value=$obj->idcardInfo->birthday;$value.=','.$obj->idcardInfo->sex;$value.=','.$obj->idcardInfo->province;$value.=','.$obj->idcardInfo->city;$value.=','.$obj->idcardInfo->dis;}else{$value=$obj->flag;}return $value;}//调用函数$idcard='420101199001010000';echo getIDCardInfo($idcard);exit;

方法二:以 GET 方式请求数据

//接口参数$api_url='http://cha.ebaitian.cn/api/json';$api_appid='1000xxxx';$api_appkey='56cf61af4b7897e704f67deb88ae8f24';//函数,以GET方式提交数据function getIDCardInfo($idcard){global $api_url,$api_appid,$api_appkey;$data='appid='.$api_appid.'&module=getIDCardInfo&idcard='.$idcard;$sign=hash("sha256",$data.'&appkey='.$api_appkey);$info_get=file_get_contents($api_url.'?type=get&'.$data.'&sign='.$sign);$info_json=json_decode($info_get, true);$result=$info_json['result'];if($result==1){$value=$info_json['idcardInfo']['birthday'];$value.=','.$info_json['idcardInfo']['sex'];$value.=','.$info_json['idcardInfo']['province'];$value.=','.$info_json['idcardInfo']['city'];$value.=','.$info_json['idcardInfo']['dis'];}else{$value=$info_json['flag'];}return $value;}//调用函数$idcard='420101199001010000';echo getIDCardInfo($idcard);exit;

Java SDK

//以下示例是以 GET 方式请求数据public class QueryHelper {public static String apiurl="http://cha.ebaitian.cn/api/json";public static String appid="1000xxxx";public static String appkey="56cf61af4b7897e704f67deb88ae8f24";public static String module="getIDCardInfo";public static String getSHA256Str(String str){MessageDigest messageDigest;String encdeStr="";try {messageDigest=MessageDigest.getInstance("SHA-256");byte[] hash=messageDigest.digest(str.getBytes("UTF-8"));encdeStr=Hex.encodeHexString(hash);} catch (NoSuchAlgorithmException e) {e.printStackTrace();} catch (UnsupportedEncodingException e) {e.printStackTrace();}return encdeStr;}public static String get(String urlString) {try {URL url=new URL(urlString);HttpURLConnection conn=(HttpURLConnection) url.openConnection();conn.setConnectTimeout(5 * 1000);conn.setReadTimeout(5 * 1000);conn.setDoInput(true);conn.setDoOutput(true);conn.setUseCaches(false);conn.setInstanceFollowRedirects(false);conn.setRequestMethod("GET");int responseCode=conn.getResponseCode();if (responseCode==200) {StringBuilder builder=new StringBuilder();BufferedReader br=new BufferedReader(new InputStreamReader(conn.getInputStream(),"utf-8"));for (String s=br.readLine(); s !=null; s=br.readLine()) {builder.append(s);}br.close();return builder.toString();}} catch (IOException e) {e.printStackTrace();}return null;}public static String queryIDCard(String idcard){String sign=getSHA256Str("appid="+appid+"&module="+module+"&idcard="+idcard+"&appkey="+appkey);String url=apiurl+"?type=get&appid="+appid+"&module="+module+"&idcard="+idcard+"&sign="+sign;return get(url);}}//使用示例QueryHelper.queryIDCard("420101199001010000");

Python SDK

#!/usr/bin/python# -*- coding: utf-8 -*-import httplib2import hashlibfrom urllib.parse import urlencode #python3#from urllib import urlencode #python2apiurl='http://cha.ebaitian.cn/api/json'appid='1000xxxx'appkey='56cf61af4b7897e704f67deb88ae8f24'module='getIDCardInfo'idcard='420101199001010000'data='appid='+appid+'&module='+module+'&idcard='+idcardsign_data=data+'&appkey='+appkey# from Crypto.Cipher import AES# from Crypto.Hash import SHA256# 256hash_256=hashlib.sha256()hash_256.update(sign_data.encode('utf-8'))sign=hash_256.hexdigest()postdata=urlencode({'appid':appid,'module':module,'idcard':idcard,'sign':sign})url=apiurl+'?'+postdatahttp=httplib2.Http()response, content=http.request(url,'GET')print(content.decode("utf-8"))Node.js SDK

方法一:以 POST 方式请求数据

//以 POST 方式提交var http=require('http');var querystring=require('querystring');//参数设置var appid='1000xxxx';var appkey='56cf61af4b7897e704f67deb88ae8f24';var module='getIDCardInfo';//目标查询身份证号码var idcard='420101199001010000';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256var sign=SHA256('appid='+appid+'&module='+module+'&idcard='+idcard+'&appkey='+appkey);//这是需要提交的数据var post_data={appid: appid,module: module,idcard: idcard,sign: sign};var content=querystring.stringify(post_data);var options={hostname: 'cha.ebaitian.cn',port: 80,path: '/api/json',method: 'POST',headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}};var req=http.request(options, function (res) {console.log('STATUS: ' + res.statusCode);console.log('HEADERS: ' + JSON.stringify(res.headers));res.setEncoding('utf8');res.on('data', function (chunk) {console.log('BODY: ' + chunk);//JSON.parse(chunk)});});req.on('error', function (e) {console.log('problem with request: ' + e.message);});// write data to request bodyreq.write(content);req.end();

方法二:以 GET 方式请求数据

//以 GET 方式提交var http=require('http');var querystring=require('querystring');//参数设置var appid='1000xxxx';var appkey='56cf61af4b7897e704f67deb88ae8f24';var module='getIDCardInfo';//目标查询身份证号码var idcard='420101199001010000';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256var sign=SHA256('appid='+appid+'&module='+module+'&idcard='+idcard+'&appkey='+appkey);//这是需要提交的数据var data={appid: appid,module: module,idcard: idcard,sign: sign};var content=querystring.stringify(data);var options={hostname: 'cha.ebaitian.cn',port: 80,path: '/api/json?' + content,method: 'GET'};var req=http.request(options, function (res) {console.log('STATUS: ' + res.statusCode);console.log('HEADERS: ' + JSON.stringify(res.headers));res.setEncoding('utf8');res.on('data', function (chunk) {console.log('BODY: ' + chunk);});});req.on('error', function (e) {console.log('problem with request: ' + e.message);});req.end();

C# SDK

using System;using System.Collections.Generic;using System.Web;using System.Net;using System.Text;public class getIDCardInfo{public static string getInfo(string appid, string appkey, string module, string idcard){string url=string.Format("http://cha.ebaitian.cn/api/json?type=get&appid={0}&module={1}&idcard={2}&sgin={3}", appid, module, idcard, sgin);using (WebClient client=new WebClient()){client.Encoding=Encoding.UTF8;return client.DownloadString(url);}}}string idcardInfo=getIDCardInfo.getInfo("1000xxxx", "getIDCardInfo", "420101199001010000", "ecab4881ee80ad3d76bb1da68387428ca752eb885e52621a3129dcf4d9bc4fd4", Request.UserHostAddress);Console.WriteLine(idcardInfo);Response.Write(idcardInfo);

JavaScript SDK

方法一:以 POST 方式请求数据//使用 JQuery 请先加载最新的 JQuery 插件//参数设置var apiurl='http://cha.ebaitian.cn/api/json';var appid='1000xxxx';var appkey='56cf61af4b7897e704f67deb88ae8f24';var module='getIDCardInfo';//目标查询身份证号码var idcard='420101199001010000';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256var sign=SHA256('appid='+appid+'&module='+module+'&idcard='+idcard+'&appkey='+appkey);//提交数据$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,idcard:idcard,sign:sign},success:function(res){console.log(res);}});

方法二:以 GET 方式请求数据

//使用 JQuery 请先加载最新的 JQuery 插件//参数设置var apiurl='http://cha.ebaitian.cn/api/json';var appid='1000xxxx';var appkey='56cf61af4b7897e704f67deb88ae8f24';var module='getIDCardInfo';//目标查询身份证号码var idcard='420101199001010000';//签名,SHA256 不可直接调用;函数参考下载地址:https://github.com/alexweber/jquery.sha256var sign=SHA256('appid='+appid+'&module='+module+'&idcard='+idcard+'&appkey='+appkey);//提交数据$.ajax({url:apiurl,type:'post',dataType:'json',data:{appid:appid,module:module,idcard:idcard,sign:sign},success:function(res){console.log(res);}});

ASP SDK

'设置参数dim apiurl, appid, appkey, module, idcard, signapiurl="http://cha.ebaitian.cn/api/json"appid="1000xxxx'appkey="56cf61af4b7897e704f67deb88ae8f24"module="getIDCardInfo"idcard="420101199001010000"'签名,SHA256 不可直接调用;函数参考地址:https://blog.csdn.net/yesoce/article/details/128546sgin=SHA256("appid=&appid&"&module="&module&"&idcard="&idcard&"&appkey="&appkey)'异步提交数据function PostHTTPPage(url,data)dim Httpset Http=server.createobject("MSXML2.SERVERXMLHTTP.3.0")Http.open "POST",url,falseHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"Http.send(data)if Http.readystate<>4 thenexit functionEnd ifPostHTTPPage=bytesToBSTR(Http.responseBody,"UTF-8")set http=nothingif err.number<>0 then err.ClearEnd function'提交数据dim postdata, strTestpostdata="appid=&appid&"&module="&module&"&idcard="&idcard&"&sign="&signstrTest=PostHTTPPage(apiurl,postdata)'返回结果response.write(strTest)response.end

常见问题

API 接口参数为空

此错误返回 JSON 数据如下:

Copy

{

"result":0,

"description":"API接口参数为空",

"flag":"appid:sign"

}

解决方法:

1)请检查 appid 及 sign 是否为空;

2)确保 appid 是从官网获取到正确的接口授权;

3)确保 sign 计算生成是正确的。

API 接口参数无效

此错误返回 JSON 数据如下:

Copy

{

"result":0,

"description":"API接口参数无效",

"flag":"appid"

}

解决方法:

1)请检查 appid 是否正确;

2)确保 appid 是从官网获取到正确的接口授权。

API 接口授权已到期

此错误返回 JSON 数据如下:

Copy

{

"result":0,

"description":"API接口授权已到期",

"flag":"end:2018-12-31 23:59:59"

}

解决方法:

1)请检查 appid 对应接口授权的期限是否过期;

2)如果接口授权过期,请到官网更新(免费用户直接更新,无需续费)或续费(针对商业付费用户)。

签名错误

此错误返回 JSON 数据如下:

Copy

{

"result":0,

"description":"签名错误",

"flag":"getIDCardInfo->sign"

}

解决方法:

1)请检查 sign 签名计算是否正确;

2)签名 sign 根据公式 $sign=sha256(appid=$appid&module=getIDCardInfo&idcard=$idcard&appkey=$appkey) 生成;其中:appkey 为授权接口的 AppKey,请填写您在我要查官网上申请到的 AppKey 。

请求受限

此错误返回 JSON 数据如下:

Copy

{

"result":0,

"description":"请求受限",

"flag":"getIDCardInfo->daylimit"

}

解决方法:

1)授权接口已超出当前接口产品请求的最大限制;

2)请根据实际使用需求升级您的接口产品。

本文部分内容来自互联网,如有疑问请与我们联系。

发布者:币侠,转转请注明出处:https://www.yfhhf.com/baike/12229.html

(0)
                       
上一篇 2022年 9月 29日 上午5:26
下一篇 2022年 9月 29日 上午6:00

相关推荐

  • 什么快递寄东西最便宜(什么快递寄东西最便宜广西北海什么快递最便宜)

    以前物流运输行业还不发达的时候,大家要想把一件东西送到其他的地方,只能自己开车或者坐公共交通送过去,随着时代的进步,现在大家运送东西可以直接通过快递或者物流,而且速度也是比较快的,现在我国快递公司是非常多的,对于寄快递的收费也不相同,那么寄什么快递最便宜?寄快递的收费标准是什么?下面就由小编来为大家详细介绍一下相关内容吧! 寄什么快递最便宜 寄什么快递最便宜…

    2023年 1月 16日
    1760
  • win10自带录屏(win10自带录屏软件在哪里)

    今天给大家分享一种超简单的电脑录屏方法,原来Win10系统自带录屏功能,用起来超爽。 01.电脑自带录制 其实Win10系统本身自带录屏功能,直接按下快捷键【Win+G】,就能一键召唤Xbox Game Bar。它除了录屏之外,还有支持截屏、查看电脑性能、音频设置等功能。 电脑自带的录屏工具,主要是用于游戏录屏的,也可以录制应用窗口、文件窗口,如果桌面上没有…

    2023年 3月 29日
    1560
  • gamil邮箱(gmail邮箱下载)

    Gmail的邮箱名中,有两个特殊字符 . 和 + ,他们都会被Gmail服务器忽略( + 有点不同)。 先来说 . ,这个字符包含在邮箱名里,它自己会被忽略掉,举个例子: abc@gmail.coma.b.c@gmail.com 给这两个邮箱发邮件都会发到abc@gmail.com,也就是没有 . 的邮箱。 再来说说 + ,这个字符在邮箱名里,自己以及后面跟…

    2022年 9月 13日
    1950
  • 中国特种部队世界排名(中国特种部队世界排名第几)

    前段时间有很多朋友都想知道中国特种部队世界排名是什么。今天小编特意为大家整理了相关知识来解答!还有其他网友想搞清楚中国特种部队世界排名第几,币侠网小编(www.yfhhf.com)现在为大家找到了相关问题的答案,接下来一起看看吧,希望能给大家带来帮助。 前言:特种部队,这个词在我们心中既熟悉又陌生,熟悉的是我们能经常听到这个词,陌生的是,我们从来没有见过他们…

    2022年 9月 18日
    2580
  • 38.6歌词歌曲原唱(386歌词歌曲原唱)

    进入羊圈第一天。 早上起来嗓子就不舒服,感觉有东西堵在嗓子眼似的。赶紧吃了感冒药,多喝水 。直到中午都感觉尚可。 午饭后带老三午睡,醒后我脸上出现可疑的红晕,孩爸说,你羊了,发烧了。但并没有其他不适。没量体温。 中午就发了面,准备做包子和饺子的。想着我这天选做饭人万一羊了,娃儿们也能吃点简单美味的,顺便能照顾我裹腹啥的。 ?做包子的过程中,感觉有点心慌气短,…

    百科问答 2023年 4月 26日
    1540

联系我们

不接风险内容

在线咨询: QQ交谈

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信