PHP code example of o0x00 / aliyunsdk

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

    

o0x00 / aliyunsdk example snippets



live\Request\V20161101\DescribeLiveRecordConfigRequest;

/**
 * init aliyun core
 *
 * @author 剑心 <[email protected]>
 * @DateTime  2018-12-01
 * @return    object 	DefaultAcsClient
 */
function initClict()
{
	//config http proxy
	define('ENABLE_HTTP_PROXY', false);
	define('HTTP_PROXY_IP', '127.0.0.1');
	define('HTTP_PROXY_PORT', '8888');

	// read config : [$regionId, $accessKeyId, $accessSecret]
	$iClientProfile = DefaultProfile::getProfile("cn-shanghai", "******", "******************");
	return new DefaultAcsClient($iClientProfile);
}

// eg: Query live config
// doc: https://help.aliyun.com/document_detail/35420.html

$client = initClict();
$data = [];
$data['AppName'] = ****';
$data['DomainName'] = '*****.com';
try {
    $DescribeLiveRecordConfigRequest = new DescribeLiveRecordConfigRequest();
    $DescribeLiveRecordConfigRequest->setDomainName($data['DomainName']);
    $response = $client->getAcsResponse($DescribeLiveRecordConfigRequest);
} catch (\Throwable $th) {
    print_r($th);
    exit("error");
}

foreach($response->LiveAppRecordList->LiveAppRecord as $k=>$v)
{
	echo '<pre>';
    print_r($v);
	echo '</pre>';
}


/*

stdClass Object
(
    [StreamName] => *
    [CreateTime] => 2017-10-30T11:05:52Z
    [DomainName] => *****.*****.com.cn
    [RecordFormatList] => stdClass Object
        (
            [RecordFormat] => Array
                (
                    [0] => stdClass Object
                        (
                            [Format] => mp4
                            [CycleDuration] => 3300
                            [OssObjectPrefix] => record/tlive/{Date}/{StreamName}/{StartTime}_{EndTime}
                        )

                )

        )

    [OssEndpoint] => oss-cn-shanghai.aliyuncs.com
    [AppName] => tlive
    [OssBucket] => ****-****-****
    [OnDemond] => 0
)

 */