PHP code example of xianrenqh / dingxiang-php-sdk
1. Go to this page and download the library: Download xianrenqh/dingxiang-php-sdk 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/ */
xianrenqh / dingxiang-php-sdk example snippets
use xianrenqh\Dingxiang\CaptchaClient;
$appId = "appId";
$appSecret = "appSecret";
$client = new CaptchaClient($appId, $appSecret);
$client->setTimeOut(2);
//指定服务器地址,saas可在控制台,应用管理页面最上方获取
$client->setCaptchaUrl("https://xxx.dingxiang-inc.com/api/tokenVerify");
$response = $client->verifyToken($param['captcha_token']);
var_dump($response->serverStatus);
//确保验证状态是SERVER_SUCCESS,SDK中有容错机制,在网络出现异常的情况会返回通过
if($response->result){
echo "true";
/**token验证通过,继续其他流程**/
}else{
echo "false";
/**token验证失败**/
}