123456789101112131415161718192021222324252627282930 |
- <?php
- require dirname(__FILE__, 2) . '/vendor/autoload.php';
- $secretId = "SECRETID";
- $secretKey = "SECRETKEY";
- $region = "ap-beijing";
- $cosClient = new Qcloud\Cos\Client(
- array(
- 'region' => $region,
- 'scheme' => 'https',
- 'credentials'=> array(
- 'secretId' => $secretId,
- 'secretKey' => $secretKey)));
- try {
- $signedUrl = $cosClient->getPresignedUrl(
- $method='getObject',
- $args=array(
- 'Bucket'=>'examplebucket-1250000000',
- 'Key'=>'exampleobject',
- 'Body'=>'',
- 'Params'=>array(),
- 'Headers'=>array()),
- $expires='+30 minutes');
-
- echo($signedUrl);
- } catch (\Exception $e) {
-
- echo($e);
- }
|