PHP code example of easy-cloud-request / volc-tos

1. Go to this page and download the library: Download easy-cloud-request/volc-tos 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/ */

    

easy-cloud-request / volc-tos example snippets





syCloudRequest\Core\SimpleCloud;
use EasyCloudRequest\Core\Support\RequestBag;
use EasyCloudRequest\VolcTos\Gateway;
use EasyCloudRequest\VolcTos\Helper\Helper;

$request = new RequestBag(
    'GET',
    'https://bucketname.tos-cn-beijing.volces.com',
    [
        'list-type' => 2,
        'region' => 'cn-beijing',
    ],
    // [
    //     'Host' => 'bucketname.tos-cn-beijing.volces.com',
    // ],
);

$cloud = new SimpleCloud([
    'default' => Gateway::class,
    'gateway' => [
        'volcTos' => [
            'ak' => 'your-ak',
            'sk' => 'your-sk',
        ]
    ],
    'http_options' => [
        "http_errors" => false,
        "proxy" => [],
        "verify" => false,
        "timeout" => 120,
        "connect_timeout" => 60,
    ]
]);
$result = $cloud->requests($request);
var_dump($result);