1. Go to this page and download the library: Download alibabacloud/client 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/ */
alibabacloud / client example snippets
use AlibabaCloud\Client\AlibabaCloud;
AlibabaCloud::accessKeyClient('accessKeyId', 'accessKeySecret')->asDefaultClient();
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;
try {
$result = AlibabaCloud::roa()
->regionId('cn-hangzhou') // Specify the requested regionId, if not specified, use the client regionId, then default regionId
->product('CS') // Specify product
->version('2015-12-15') // Specify product version
->action('DescribeClusterServices') // Specify product interface
->serviceCode('cs') // Set ServiceCode for addressing, optional
->endpointType('openAPI') // Set type, optional
->method('GET') // Set request method
->host('cs.aliyun.com') // Location Service will not be enabled if the host is specified. For example, service with a Certification type-Bearer Token should be specified
->pathPattern('/clusters/[ClusterId]/services') // Specify path rule with ROA-style
->withClusterId('123456') // Assign values to parameters in the path. Method: with + Parameter
->request(); // Make a request and return to result object. The request is to be placed at the end of the setting
print_r($result->toArray());
} catch (ClientException $exception) {
print_r($exception->getErrorMessage());
} catch (ServerException $exception) {
print_r($exception->getErrorMessage());
}
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;
try {
$result = AlibabaCloud::rpc()
->product('Cdn')
->version('2014-11-11')
->action('DescribeCdnService')
->method('POST')
->request();
print_r($result->toArray());
} catch (ClientException $exception) {
print_r($exception->getErrorMessage());
} catch (ServerException $exception) {
print_r($exception->getErrorMessage());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.