PHP code example of haxibiao / vod-php-sdk

1. Go to this page and download the library: Download haxibiao/vod-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/ */

    

haxibiao / vod-php-sdk example snippets




use Vod\VodUploadClient;
use Vod\Model\VodUploadRequest;

$client = new VodUploadClient("your secretId", "your secretKey");
$req = new VodUploadRequest();
$req->MediaFilePath = "the path to media file";
$req->CoverFilePath = "the path to cover file";
try {
    $rsp = $client->upload("ap-guangzhou", $req);
    echo "FileId => ". $rsp->FileId . "\n";
    echo "MediaUrl -> ". $rsp->MediaUrl . "\n";
    echo "CoverUrl -> ". $rsp->CoverUrl . "\n";
} catch (Exception $e) {
    // 处理上传异常
    echo $e;
}



use Vod\VodUploadClient;
use Vod\Model\VodUploadRequest;

$client = new VodUploadClient("your secretId", "your secretKey");
$req = new VodUploadRequest();
$req->MediaFilePath = "the path to media file";
$req->CoverFilePath = "the path to cover file";
try {
    $rsp = $client->upload("ap-guangzhou", $req);
    echo "FileId => ". $rsp->FileId . "\n";
    echo "MediaUrl -> ". $rsp->MediaUrl . "\n";
    echo "CoverUrl -> ". $rsp->CoverUrl . "\n";
} catch (Exception $e) {
    // 处理上传异常
    echo $e;
}