PHP code example of lala437 / ksyun_sdk
1. Go to this page and download the library: Download lala437/ksyun_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/ */
lala437 / ksyun_sdk example snippets
syun\Service\Iam;
$response = Iam::getInstance()->request('ListUsers');
echo (string)$response->getBody();
syun\Service\Kec;
$response = Kec::getInstance()->request('DescribeInstances', [], 'cn-beijing-6');
echo (string)$response->getBody();
syun\Service\Eip;
$response = Eip::getInstance()->request('DescribeAddresses', ['query' => ['MaxResults' => 10]], 'cn-beijing-6');
echo (string)$response->getBody();
syun\Service\Iam;
$ak = 'this is ak';
$sk = 'this is sk';
$response = Iam::getInstance()->request('ListUsers', ['v4_credentials' => ['ak' => $ak, 'sk' => $sk]]);
echo (string)$response->getBody();
syun\Service\Cdn; //详细CDN api调用示例 位于./tests/CdnTest.php
$response = Iam::getInstance()->request('GetCdnDomains', ['query'=>['DomainStatus' => 'online', 'CdnType' => 'download']);
echo (string)$response->getBody();
syun\Service\Monitor; //详细Monitor api调用示例 位于./tests/MonitorTest.php
$response = Monitor::getInstance()->request('ListMetrics', ['query'=['Namespace' => 'KEC', 'InstanceID' => '7af8d721-fb03-4d5b-a4a7-0ff983a2c30b', 'PageIndex' => 1]], 'cn-beijing-6');
echo (string)$response->getBody();