腾讯云身份信息认证

1 官网下载sdk 必定要git 或者composer    sdk: https://cloud.tencent.com/document/api/1007/33188  php

直接引用sdk 就能够 ,而后他的sdk有几个是没有引用路径的 ,跟着报错找到那个没有引用,require_once 引用上就能够、html

控制器代码:git

require_once (dirname(dirname(dirname((dirname(__FILE__))))).'/extend/TCloudAutoLoader.php');json

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;api

function carid(){composer

  $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);curl

    echo "<pre>";ui

  print_r($code);url

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

相关文章
相关标签/搜索