本文为您提供了服务端 PHP SDK 的点播 CDN 模块的接口调用示例。
接口请求参数和返回参数详见 OpenAPI:创建域名。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodCreateDomainV2Request(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $request->setSourceStationType(0); $request->setSourceStationAddressType(0); $request->setOrigins("your Origins"); $request->setArea("your Area"); $request->setBucketName("your BucketName"); $response = new Volc\Service\Vod\Models\Response\VodCreateDomainV2Response(); try { $response = $client->createDomain($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:启用域名。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodStartDomainRequest(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $request->setSourceStationType(0); $response = new Volc\Service\Vod\Models\Response\VodStartDomainResponse(); try { $response = $client->startDomain($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:停用域名。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodStopDomainRequest(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $request->setSourceStationType(0); $response = new Volc\Service\Vod\Models\Response\VodStopDomainResponse(); try { $response = $client->stopDomain($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:删除域名。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodDeleteDomainRequest(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $response = new Volc\Service\Vod\Models\Response\VodDeleteDomainResponse(); try { $response = $client->deleteDomain($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:获取空间域名列表。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodListDomainRequest(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setSourceStationType(0); $request->setOffset(0); $request->setLimit(0); $response = new Volc\Service\Vod\Models\Response\VodListDomainResponse(); try { $response = $client->listDomain($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:将域名添加至点播调度。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodAddDomainToSchedulerRequest(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $request->setSourceStationType(0); $response = new Volc\Service\Vod\Models\Response\VodAddDomainToSchedulerResponse(); try { $response = $client->addDomainToScheduler($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:将域名移除点播调度。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodRemoveDomainFromSchedulerRequest(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $request->setSourceStationType(0); $response = new Volc\Service\Vod\Models\Response\VodRemoveDomainFromSchedulerResponse(); try { $response = $client->removeDomainFromScheduler($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:设置域名分发规则。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodUpdateDomainPlayRuleRequest(); $request->setSpaceName("your SpaceName"); $request->setDefaultDomain("your DefaultDomain"); $request->setPlayRule("your PlayRule"); $response = new Volc\Service\Vod\Models\Response\VodUpdateDomainPlayRuleResponse(); try { $response = $client->updateDomainPlayRule($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:修改域名时间戳防盗链。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodUpdateDomainExpireV2Request(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $request->setExpire(0); $response = new Volc\Service\Vod\Models\Response\VodUpdateDomainExpireV2Response(); try { $response = $client->updateDomainExpire($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:修改域名 URL 鉴权配置。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodUpdateDomainUrlAuthConfigV2Request(); $request->setSpaceName("your SpaceName"); $request->setDomainType("your DomainType"); $request->setDomain("your Domain"); $request->setMainKey("your MainKey"); $request->setBackupKey("your BackupKey"); $request->setStatus("your Status"); $response = new Volc\Service\Vod\Models\Response\VodUpdateDomainUrlAuthConfigV2Response(); try { $response = $client->updateDomainUrlAuthConfig($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:刷新缓存。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodCreateCdnRefreshTaskRequest(); $request->setSpaceName("your SpaceName"); $request->setUrls("your Urls"); $request->setType("your Type"); $response = new Volc\Service\Vod\Models\Response\VodCreateCdnRefreshTaskResponse(); try { $response = $client->createCdnRefreshTask($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:预热缓存。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodCreateCdnPreloadTaskRequest(); $request->setSpaceName("your SpaceName"); $request->setUrls("your Urls"); $response = new Volc\Service\Vod\Models\Response\VodCreateCdnPreloadTaskResponse(); try { $response = $client->createCdnPreloadTask($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:获取刷新预热任务列表。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodListCdnTasksRequest(); $request->setSpaceName("your SpaceName"); $request->setTaskId("your TaskId"); $request->setDomainName("your DomainName"); $request->setTaskType("your TaskType"); $request->setStatus("your Status"); $request->setStartTimestamp(0); $request->setEndTimestamp(0); $request->setPageNum(0); $request->setPageSize(0); $response = new Volc\Service\Vod\Models\Response\VodListCdnTasksResponse(); try { $response = $client->listCdnTasks($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }
接口请求参数和返回参数详见 OpenAPI:获取日志文件下载地址。
<?php require('../../vendor/autoload.php'); // Create a VOD instance in the specified region. // $client = Volc\Service\Vod\Vod::getInstance('cn-north-1'); $client = Volc\Service\Vod\Vod::getInstance(); // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/4408. // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed. // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account. // $client->setAccessKey('your ak'); // $client->setSecretKey('your sk'); $request = new Volc\Service\Vod\Models\Request\VodListCdnAccessLogRequest(); $request->setDomains("your Domains"); $request->setStartTimestamp(0); $request->setEndTimestamp(0); $request->setSpaceName("your SpaceName"); $response = new Volc\Service\Vod\Models\Response\VodListCdnAccessLogResponse(); try { $response = $client->listCdnAccessLog($request); } catch (Exception $e) { echo $e, "\n"; } catch (Throwable $e) { echo $e, "\n"; } if ($response != null && $response->getResponseMetadata() != null && $response->getResponseMetadata()->getError() != null) { echo $response->getResponseMetadata()->getError()->serializeToJsonString(), "\n"; } else { echo $response->serializeToJsonString(), "\n"; }