You need to enable JavaScript to run this app.
导航

其他配置

最近更新时间2022.08.03 11:07:54

首次发布时间2022.08.03 11:07:54

本文为您提供了服务端 PHP SDK 的其他配置模块相关的 API 调用示例。主要包含:获取回调事件、添加回调订阅地址等。

初始化

使用前请先完成初始化,参考初始化

获取回调事件

接口请求参数和返回参数详见 OpenAPI:获取回调事件

<?php
require('../../vendor/autoload.php');

use Volc\Service\Vod\Models\Request\VodSetCallbackEventRequest;
use Volc\Service\Vod\Models\Response\VodSetCallbackEventResponse;
use Volc\Service\Vod\Vod;

$client = Vod::getInstance();
$client->setAccessKey('your ak');
$client->setSecretKey('your sk');

$request = new VodSetCallbackEventRequest();
$request->setSpaceName("your space name");
$request->setEvents("your event");
$request->setAuthEnabled("your auth enabled: 1 or 0");
$request->setPrivateKey("your private key");

$response = new VodSetCallbackEventResponse();
try {
    $response = $client->setCallbackEvent($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response->getResponseMetadata()->getError() != null) {
    print_r($response->getResponseMetadata()->getError());
}
echo $response->serializeToJsonString();
echo "\n";

添加回调订阅地址

接口请求参数和返回参数详见 OpenAPI:添加回调订阅地址

<?php
require('../../vendor/autoload.php');

use Volc\Service\Vod\Models\Request\VodAddCallbackSubscriptionRequest;
use Volc\Service\Vod\Models\Response\VodAddCallbackSubscriptionResponse;
use Volc\Service\Vod\Vod;

$client = Vod::getInstance();
$client->setAccessKey('your ak');
$client->setSecretKey('your sk');

$request = new VodAddCallbackSubscriptionRequest();
$request->setSpaceName("your space name");
$request->setUrl("your callback subscription url");
$request->setContentType("your ContentType");

$response = new VodAddCallbackSubscriptionResponse();
try {
    $response = $client->addCallbackSubscription($request);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response->getResponseMetadata()->getError() != null) {
    print_r($response->getResponseMetadata()->getError());
}
echo $response->serializeToJsonString();
echo "\n";