首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >腾讯云人脸比对 总是签名错误?

腾讯云人脸比对 总是签名错误?

提问于 2020-06-12 17:22:57
回答 0关注 0查看 292

人脸对比接口https://cloud.tencent.com/document/product/867/44987

报错如下

"The provided credentials could not be validated. Please check your signature is correct."

<?php

header("X-TC-Action: no-cache");

header('X-TC-Timestamp: '.time().'');

header("X-TC-Version: 2020-03-03");

header("Authorization: Signature");

header("host: cvm.tencentcloudapi.com");

header("content-type:application/json");

load()->func('communication');

$SecretId='111';

$secretKey='2222';

$param['Action']="CompareFace";

$param['Timestamp']=time();

$param['Nonce']=rand();

$param['SecretId']=$SecretId;

$param['Version']='2020-03-03';

$param['UrlA']='https://up.enterdesk.com/edpic_360_360/3a/d1/66/3ad1668da63c67a9dc421238938dfb8c.jpg';

$param['UrlB']='https://up.enterdesk.com/edpic_360_360/3a/d1/66/3ad1668da63c67a9dc421238938dfb8c.jpg';

$param['QualityControl']='0';

ksort($param);

$url='https://iai.tencentcloudapi.com';

$signStr = "GETiai.tencentcloudapi.com/?";

foreach ( $param as $key => $value ) {

$signStr = $signStr . $key . "=" . $value . "&";

}

$aa = substr($signStr, 0, -1);

$signature = base64_encode(hash_hmac("sha1", $signStr, $secretKey, true));

$param['Signature']=$signature;

$data=ihttp_post($url, $param);

$this->result(0,'信息',json_decode($data['content'],TRUE));

?>

应该咋写 谁又完整代码 求copy

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档