有乎-价值、共享、信任

What you care about-value, sharing, trust

银行卡实名认证-银行卡四要素(阿里云市场)

| 阅读:1518 发表时间:2020-03-18 08:27:30 技术专栏

提示:这个仅仅是其中的一家,仅用来做测试用!!

测试地址:链接

public function aliyunCert($data){
    	$host = "http://zbv2.market.alicloudapi.com";
	    $path = "/v1/bcheck";
	    $method = "GET";
	    $appcode = "自己的APPCode";
	    $headers = array();
	    array_push($headers, "Authorization:APPCODE " . $appcode);
	    $querys = "accountNo=".$data['bankcard']."&bankPreMobile=&idCardCode=".$data['idcard']."&name=".urlencode($data['realname']);
	    $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, 0);
	    if (1 == strpos("$".$host, "https://"))
	    {
	        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
	        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
	    }
	    $ret = curl_exec($curl);
	    file_put_contents("cert.log", $ret, FILE_APPEND);
	    $ret = json_decode($ret, 1);
	    
		if($ret){
			$tmp['status'] = 0;
			$tmp['msg'] = $ret['reason'];
			if($ret['error_code'] == '0'){
				//成功
				if($ret['result']['result'] == 'T'){
					$tmp['status'] = 0;
				}else{
					$tmp['status'] = -1;
					$tmp['msg'] = $ret['result']['message'];
				}
			}
		}else{
			$tmp['status'] = -1;
			$tmp['msg'] = '身份接口验证请求失败,请联系管理员!';
			//失败
		}
		return $tmp;
    }
*文章为作者独立观点,不代表【uuuho有乎】的立场
本文由【uuuho有乎】发表并编辑,转载此文章须经作者同意,并请附上出处及本页链接。如有侵权,请联系本站删除。