All Products
Search
Document Center

CDN

Last Updated: Jul 11, 2019

Initialize a client

Initialize a client before using the SDK. For more information, see initVodClient.

Preload content to cache nodes

For more information about the request and response parameters, see PreloadVodObjectCaches.

function preloadVodObjectCaches($client) {
    $request = new vod\PreloadVodObjectCachesRequest();
    // Sets the URL of the content to be preloaded.
    $request->setObjectPath("http://test.com/fd.mp4"); 

    return $client->getAcsResponse($request); 
}


try {
    $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>'); 
    $result = preloadVodObjectCaches($client);

    var_dump($result);
} catch (Exception $e) {
    print $e->getMessage()."\n"; 
}

Refresh the cached content on nodes

For more information about the request and response parameters, see RefreshVodObjectCaches.

function refreshVodObjectCaches($client) {
    $request = new vod\RefreshVodObjectCachesRequest();
    // Sets the URL of the content to be refreshed.
    $request->setObjectPath("http://test.com/fd.mp4"); 
    // Sets the type of the content to be refreshed.
    $request->setObjectType("File");

    return $client->getAcsResponse($request); 
}

try {
    $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>'); 
    $result = refreshVodObjectCaches($client);

    var_dump($result);
} catch (Exception $e) {
    print $e->getMessage()."\n"; 
}

Query the status of refresh and preload tasks

For more information about the request and response parameters, see DescribeVodRefreshTasks.

function describeVodRefreshTasks($client) {
    $request = new vod\DescribeVodRefreshTasksRequest();
    // Specifies the domain name to be queried.
    $request->setDomainName("test.com");
    // Sets the task type.
    $request->setObjectType("file");

    return $client->getAcsResponse($request); 
}

try {
    $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
    $result = describeVodRefreshTasks($client);

    var_dump($result);
} catch (Exception $e) {
    print $e->getMessage()."\n"; 
}

Query the maximum number and remaining number of requests to refresh and preload content on the current day

For more information about the request and response parameters, see DescribeVodRefreshQuota.

function describeVodRefreshQuota($client) {
    $request = new vod\DescribeVodRefreshQuotaRequest();
    return $client->getAcsResponse($request); 
}

try {
    $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>'); 
    $result = describeVodRefreshQuota($client);

    var_dump($result);
} catch (Exception $e) {
    print $e->getMessage()."\n";
}

Obtain the network traffic monitoring data for accelerating domain names

For more information about the request and response parameters, see DescribeVodDomainTrafficData.

function describeVodDomainTrafficData($client) {
    $request = new vod\DescribeVodDomainTrafficDataRequest();
    // Specifies the domain name to be queried.
    $request->setDomainName("example.test.com"); 
    // Sets the start time of queried data, in UTC.
    $request->setStartTime("2019-01-15T15:59:59Z"); 
    // Sets the end time of queried data, in UTC.
    $request->setEndTime("2019-01-20T15:59:58Z"); 

    return $client->getAcsResponse($request);
}

try {
    $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>'); 
    $result = describeVodDomainTrafficData($client);

    var_dump($result);
} catch (Exception $e) {
    print $e->getMessage()."\n";
}

Obtain the network bandwidth monitoring data for accelerating domain names

For more information about the request and response parameters, see DescribeVodDomainBpsData.

function describeVodDomainBpsData($client) {
    $request = new vod\DescribeVodDomainBpsDataRequest();
    // Specifies the domain name to be queried.
    $request->setDomainName("example.test.com"); 
    // Sets the start time of queried data, in UTC.
    $request->setStartTime("2019-01-15T15:59:59Z"); 
    // Sets the end time of queried data, in UTC.
    $request->setEndTime("2019-01-20T15:59:58Z"); 

    return $client->getAcsResponse($request); 
}

try {
    $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
    $result = describeVodDomainBpsData($client);

    var_dump($result);
} catch (Exception $e) {
    print $e->getMessage()."\n"; 
}

Download raw CDN access logs for a specified domain name

For more information about the request and response parameters, see DescribeVodDomainLog.

function describeVodDomainLog($client) {
    $request = new vod\DescribeVodDomainLogRequest();
    // Specifies the domain name to be queried.
    $request->setDomainName("zhptest.alicdn.com");
    // Sets the start time of queried logs, in UTC.
    $request->setStartTime("2019-01-15T21:00:00Z"); 
    // Sets the end time of queried logs, in UTC.
    $request->setEndTime("2019-01-15T22:00:00Z"); 

    return $client->getAcsResponse($request);
}

try {
    $client = initVodClient('<AccessKeyId>', '<AccessKeySecret>');
    $result = describeVodDomainLog($client);

    var_dump($result);
} catch (Exception $e) {
    print $e->getMessage()."\n"; 
}