在云市场中购买免费使用50次的实名认证接口【天眼数聚】身份实名认证-身份证实名认证-身份证二要素验证-身份证实名校验-实名认证查询核验接口api-优质版-官方数据【最新版】_实名认证接口/API_身份证接口/API_电商-云市场-阿里云
/**
* Name:用户实名认证
* User: hp
* Date: 2023/6/11
* Time:23:13
*/
public function RealName(Request $request)
{
$idcard = "152xxxxxxxxxxxxxxx
";
$name = "xx";
$host = "https://eid.shumaidata.com";
$path = "/eid/check";
$method = "POST";
$appcode = "=====================
";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "idcard=$idcard&name=$name";
$bodys = "";
$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, true);
//设定返回信息中是否包含响应信息头,启用时会将头文件的信息作为数据流输出,true 表示输出信息头, false表示不输出信息头
//如果需要将字符串转成json,请将 CURLOPT_HEADER 设置成 false
curl_setopt($curl, CURLOPT_HEADER, true);
if (1 == strpos("$" . $host, "https://")) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
var_dump(curl_exec($curl));
}
设置路由,定义传参,请求接口完成
Route::post('RealName',[\App\Http\Controllers\LoginController::class,'RealName']);