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