cakephp

腾讯云获取视频信息接口

2019-11-26  本文已影响0人  永不言弃__

示例:

$SecretId = 'xxxxxxxxxxxxxxx';

    $SecretKey = 'xxxxxxxxxxxxxxx';

    $Nonce = rand(111111,999999);

    $time = time();

    $str = 'Action=GetVideoInfo&Nonce='.$Nonce.'&Region=cd&SecretId='.$SecretId.'&Timestamp='.$time .'&fileId=xxxxxxxxxxxxxxx&infoFilter.0=basicInfo';

    $srcStr = 'GETvod.api.qcloud.com/v2/index.php?'.$str;

    pr($srcStr);

    $signStr = base64_encode(hash_hmac('sha1', $srcStr, $SecretKey, true));

    pr($signStr);

    $signStr = urlencode($signStr);

    pr($signStr);

    $http = new Client();

    pr('https://vod.api.qcloud.com/v2/index.php?'.$str.'&Signature='.$signStr);

    $response = $http->get('https://vod.api.qcloud.com/v2/index.php?'.$str.'&Signature='.$signStr);

    pr($response->json);exit;

这是cakephp请求的方式,其中要注意的是Signature参数的签名方式,尤其注意参数排序要正确,大写字母排序比小写字母排序靠前,还要注意GET方式对参数值进行urlencode()

具体腾讯云接口查看地址:https://cloud.tencent.com/document/product/266/8586

上一篇下一篇

猜你喜欢

热点阅读