腾讯云身份信息认证

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下载的地方在下载一个证书就可以了

 

转载于:https://www.cnblogs.com/qgzr/p/11389911.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值