PHP code example of lokielse / aliyun-open-api-mts

1. Go to this page and download the library: Download lokielse/aliyun-open-api-mts 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/ */

    

lokielse / aliyun-open-api-mts example snippets


/**
 * 访问信息
 */
$config = [
	'AccessKeyId'=>'<your access_key_id>',
	'AccessKeySecret'=>'<your access_key_secret>',
];

/**
 * 配置网关
 */
$endpoint = new Endpoint('cn-hangzhou', EndpointConfig::getRegionIds(), EndpointConfig::getProductDomains());
EndpointProvider::setEndpoints([ $endpoint ]);

/**
 * 授权资料
 */
$profile = DefaultProfile::getProfile('cn-hangzhou', $config['AccessKeyId'], $config['AccessKeySecret']);

/**
 * 输入文件信息
 */
$input = [
	'Bucket'   => 'zuren',
	'Location' => 'oss-cn-hangzhou',
	'Object'   => 'videos/test/input_demo_01.mp4'
];

/**
 * 输出文件信息
 */
$outputs = [
	[
		'OutputObject' => 'videos/test/input_demo_01.mp4',
		'TemplateId'   => 'S00000001-200030', //模板ID
	]
];

/**
 * 请求对象
 */
$request = new SubmitJobsRequest();
$request->setInput(json_encode($input));
$request->setOutputBucket('zuren');
$request->setOutputs(json_encode($outputs));
$request->setPipelineId('81029d8fb1724902a4f7a421f509e153'); //管道ID

$client  = new DefaultAcsClient($profile);
$response = $client->getAcsResponse($request);

var_dump($response);