当前位置:网站首页>漏刻有时API接口实战开发系列(14):身份证实名鉴权验证
漏刻有时API接口实战开发系列(14):身份证实名鉴权验证
2022-07-01 07:29:00 【漏刻有时】
项目需求
传入姓名、身份证号,校验此二要素是否一致,同时返回生日、性别、籍贯等信息。
项目请求
function getCard($idcard, $name)
{
$host = "https://eid.shumaidata.com";
$path = "/eid/check";
$method = "POST";
$appcode = "a277cc985ba54c388e72deb135d45e9d";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "idcard=" . $idcard . "&name=" . urlencode($name);
$url = $host . $path . "?" . $querys;
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, false);
if (strpos("$" . $host, "https://") == 1) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
$output = rtrim(curl_exec($curl), 1);//删除结尾的多余字符;
curl_close($curl);
return json_decode($output, true);
}
注意事项
多余字符处理
rtrim(curl_exec($curl), 1);//官方接口通过$curl爬取过来的内容,结尾存在“1”这样的异常数据,导致无法正常解析。通过rtrim函数删除结尾的多余字符。
API严谨性
同名不同身份证号也将审核通过。
@lockdata.cn
边栏推荐
猜你喜欢
随机推荐
【Flutter 问题系列第 72 篇】在 Flutter 中使用 Camera 插件拍的图片被拉伸问题的解决方案
【编程强训】删除公共字符(哈希映射)+组队竞赛(贪心)
Solution to the problem that objects in unity2021 scene view cannot be directly selected
三极管是一项伟大的发明
Is the account opening of GF Securities safe and reliable? How to open GF Securities Account
Open source! Wenxin large model Ernie tiny lightweight technology, accurate and fast, full effect
在券商账户上买基金安全吗
ctfshow-web351(SSRF)
ONES 创始人王颖奇对话《财富》(中文版):中国有没有优秀的软件?
运维面临挑战?智能运维管理系统来帮您
热烈祝贺五行和合酒成功挂牌
C language implementation [Sanzi chess game] (step analysis and implementation source code)
C# 读写自定义的Config文件
redisson使用全解——redisson官方文档+注释(下篇)
[recommendation system] breakthrough and imagination of deep location interactive network dpin for meituan takeout recommendation scenario
电脑有网络,但所有浏览器网页都打不开,是怎么回事?
2022电工(中级)复训题库及答案
C # read and write customized config file
[skill] create Bat quick open web page
2022 tea master (intermediate) recurrent training question bank and answers



![[lingo] solve quadratic programming](/img/4d/3f7de69943f29a71c4039299c547f7.png)




