百度熊掌号运营位设置

百度熊掌号运营位设置:

在账号中设置或获取:

开发信息:
用户名:    密码:
ClientId:账号获取
ClientSecret:账号获取


服务器配置:
URL:自己添加填写网址(底部附php文件内容)
Token:自行设置,加入到URL中
Encoding AESKey:账号获取


获取 access_token:

https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id={ClientId}&client_secret={ClientSecret}

access_token:以上网址获取,有效时间为2小时


获取运营位状态:

https://openapi.baidu.com/rest/2.0/cambrian/home/operationstatus?access_token=ACCESS_TOKEN


添加运营位信息:

https://openapi.baidu.com/rest/2.0/cambrian/home/addopenoperation?access_token=ACCESS_TOKEN&title=热门书籍&tag=热销&url=http://www.baidu.com


 

<?php
/**
 * 用sha1算法生成安全签名
 * @param string $strToken 票据
 * @param string $intTimeStamp 时间戳
 * @param string $strNonce 随机字符串
 * @param string $strEncryptMsg 密文消息
 * @return string
 */
function getSHA1($strToken, $intTimeStamp, $strNonce, $strEncryptMsg = '')
{
    $arrParams = array(
        $strToken, 
        $intTimeStamp, 
        $strNonce,
    );
    if (!empty($strEncryptMsg)) {
        array_unshift($arrParams, $strEncryptMsg);
    }
    sort($arrParams, SORT_STRING);
    $strParam = implode($arrParams);
    return sha1($strParam);
}

//测试代码示例
$TOKEN = '此处填写你的token';
$strSignature = getSHA1($TOKEN, $_GET['timestamp'], $_GET['nonce']);
if ($strSignature == $_GET['signature']) {
    echo $_GET['echostr'];
} else {
    //校验失败
    echo 'failed';
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值