You need to enable JavaScript to run this app.
视频点播

视频点播

复制全文
PHP SDK
工具服务
复制全文
工具服务

本文为您提供了服务端 PHP SDK 的工具服务模块的接口调用示例。

前提条件

调用接口前,请先完成集成 PHP SDK

调用示例

获取 IP 归属信息

接口请求参数和返回参数详见 OpenAPI:获取 IP 归属信息

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

use Volc\Service\Vod\Models\Request\VodDescribeIPInfoRequest;
use Volc\Service\Vod\Models\Response\VodDescribeIPInfoResponse;
use Volc\Service\Vod\Vod;

// Create a VOD instance in the specified region.
// $client = Vod::getInstance('cn-north-1');
$client = 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');

$req = new VodDescribeIPInfoRequest();
$response = new VodDescribeIPInfoResponse();
try {
    $req->setIps("your ips");
    $response = $client->describeIPInfo($req);
} catch (Exception $e) {
    echo $e, "\n";
} catch (Throwable $e) {
    echo $e, "\n";
}
if ($response->getResponseMetadata()->getError() != null) {
    print_r($response->getResponseMetadata()->getError());
} else {
    print_r($response->serializeToJsonString());
}

最近更新时间:2025.12.19 11:02:41
这个页面对您有帮助吗?
有用
有用
无用
无用