腾讯云人脸核验获取biztoken 2020-08-13 12:12:02

获取人脸核验biztoken

public function GetBiztoken () {
	$SecretId = 'XXXX';
	$SecretKey = 'XXXXXX';
	$srcStr = 'GETfaceid.tencentcloudapi.com/?';
	$param = [ 
	            "Action"=> 'DetectAuth',//默认
	            "Nonce"=> rand(1000,9999),
	            "SecretId"=>$SecretId,
	            'Region'=>'ap-beijing',//区域列表中选
	            "Timestamp"=> time(),
	            "RuleId"=>'0',//自己创建的RuleID
	            "Token"=>'',//为空
	            "Version"=>'2018-03-01'//默认
	];
	// 排序
	ksort($param);
	// 连接字符串
	$srcStr .= urldecode(http_build_query($param));
	// 生成签名 
	$sign =  urlencode(base64_encode(hash_hmac('sha1', $srcStr, $SecretKey, true)));
	// 请求地址拼写
	$url ='https://faceid.tencentcloudapi.com/?Action=DetectAuth&Nonce='.$param['Nonce'].'&Region=ap-beijing&RuleId=0&SecretId='.$param['SecretId'].'&Signature='.$sign.'&Timestamp='.$param['Timestamp'].'&Token=&Version=2018-03-01';
	// 发送请求
	$data = getCurl($url);
	return json_encode($data);
}
  1. Laravel5.7
  2. 微信相关
  3. Mysql
  4. 前端开发
  5. 随记
  6. 写作素材
  7. 开发工具
  8. 互联网