PHP code example of davidyou / tencent-qidian
1. Go to this page and download the library: Download davidyou/tencent-qidian library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
davidyou / tencent-qidian example snippets
//1.完善服务器配置
$pc = new QDMsgCrypt($token, $encodingAesKey, $appId);
$str = $pc->VerifyURL($signature, $timestamp, $nonce, $echostr, $replyEchoStr);
//2.解析xml推送内容
$pc = new QDMsgCrypt($token, $encodingAesKey, $appId);
$errCode = $pc->decryptMsg($signature, $timeStamp, $nonce, $fromXml, $msg);
//3.获取自建应用的token
$object = new SelfBuiltService($token, $encodingAesKey, $appId);
$selfBuildToken = $object->getSelfBuildToken($appId, $sid, $secret);
//4.获取ticket票据
$object = new Common($token, $encodingAesKey, $appId);
$ticketResult = $object->getTicket($encryXml, $signature, $timestamp, $nonce);
//5.根据ticket换取应用开发商token
$object = new Common($token, $encodingAesKey, $appId);
$componentAccessTokenResult = $object->getAccessToken($appId, $appSecret, $ticketValue);
//6.获取第三方应用的企业授权code,并换取企业授权token
$object = new CompanyService($token, $encodingAesKey, $appId);
$companyAccessTokenResult = $object->getCompanyAccessToken($componentAccessToken, $appId, $code);
//7.刷新企业授权token
$object = new CompanyService($token, $encodingAesKey, $appId);
$companyRefreshTokenResult = $object->getCompanyRefreshToken($componentAccessToken, $appId, $authorizerAppid, $authorizerRefreshToken, $sid);