实名认证

master
tpingzhang 5 years ago
parent 161dc7419e
commit 831b7d5ba2

@ -1198,16 +1198,65 @@ function age_verify($cardno, $name)
//根据配置向接口发送身份证号和姓名进行验证
function age($cardno, $name)
{
$host = "http://idcard.market.alicloudapi.com";
$path = "/lianzhuo/idcard";
$host = "https://idcardcert.market.alicloudapi.com";
$path = "/idCardCert";
$method = "GET";
$appcode = "244181f0846541a19e24df409736d3b9";
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "idCard=510703198602170052&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);
curl_setopt($curl, CURLOPT_HEADER, false);
//curl_setopt($curl, CURLOPT_HEADER, true); 如不输出json, 请打开这行代码,打印调试头部状态码。
//状态码: 200 正常400 URL无效401 appCode错误 403 次数用完; 500 API网管错误
if (1 == strpos("$".$host, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
$output = curl_exec($curl);
if (empty($output)) {
return -1;//用完
}
echo $output;
die;
if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == '200') {
$headersize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header = substr($output, 0, $headersize);
$body = substr($output, $headersize);
curl_close($curl);
return json_decode($body, true);
} else {
return -2;//失败
}
echo $output;
die;
$host = "https://idcardcert.market.alicloudapi.com";
$path = "/idCardCert";
$method = "GET";
$appcode = C('tool_age.appcode');
$headers = array();
$appcode = '244181f0846541a19e24df409736d3b9';
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "cardno=" . $cardno . "&name=" . $name;
$bodys = "";
$url = $host . $path . "?" . $querys;
$curl = curl_init();
// var_dump($headers);
// pp($url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
@ -1233,6 +1282,32 @@ function age($cardno, $name)
}
}
function age2($cardno, $name) {
$host = "https://idcardcert.market.alicloudapi.com";
$path = "/idCardCert";
$method = "GET";
$appcode = '244181f0846541a19e24df409736d3b9';//C('tool_age.appcode');
$headers = array();
array_push($headers, "Authorization:APPCODE " . $appcode);
$querys = "idCard={$cardno}&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);
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));
}
/*短信发送验证限制条件 */
function checksendcode($phone, $limit)
{

Loading…
Cancel
Save