腾讯云身份信息认证
1 官网下载sdk 一定要git 或者composer sdk: https://cloud.tencent.com/document/api/1007/33188
直接引用sdk 就可以 ,然后他的sdk有几个是没有引用路径的 ,跟着报错找到那个没有引用,require_once 引用上就可以、
控制器代码:
require_once (dirname(dirname(dirname((dirname(__FILE__))))).'/extend/TCloudAutoLoader.php');
use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Common\Exception\TencentCloudSDKException;
use TencentCloud\Faceid\V20180301\FaceidClient;
use TencentCloud\Faceid\V20180301\Models\IdCardVerificationRequest;
function carid(){
$cred = new Credential("腾讯云申请的SecretId", "腾讯云申请的SecretKey ");
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint("faceid.tencentcloudapi.com");
$clientProfile = new ClientProfile();
$clientProfile->setHttpProfile($httpProfile);
$client = new FaceidClient($cred, "ap-beijing", $clientProfile);
$req = new IdCardVerificationRequest();
$params = json_encode(array('IdCard'=>'身份证号','Name'=>‘姓名’));
$req->fromJsonString($params);
$resp = $client->IdCardVerification($req);
$code = json_decode($resp->toJsonString(),true);
echo "<pre>";
print_r($code);
}
如果报了一个类似于
[TencentCloud\Common\Exception\TencentCloudSDKException] code: message:cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) requestId:
这个错 就是证书的问题
去sdk下载的地方在下载一个证书就可以了