AWS SDK for PHP
Website at https://docs.aws.amazon.com/sdk-for-php.
Installation
Download and unzip https://docs.aws.amazon.com/aws-sdk-php/v3/download/aws.zip.
Create a file named `list.php` with the following contents (substituting `mybucket` and `/path/to/aws-autoloader.php` with your information):
<?php
require '/path/to/aws-autoloader.php';
use Aws\S3\S3Client;
use Aws\Exception\AwsException;
$s3 = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-east-1',
'endpoint' => 'https://polycloud.crowdapis.com',
]);
$result = $s3->listObjects([
'Bucket' => 'mybucket',
]);
foreach ($result['Contents'] as $obj) {
echo $obj['Key'] . "\n";
}
?>
Run the example:
$ AWS_ACCESS_KEY_ID=<your access key> AWS_SECRET_ACCESS_KEY=<your secret> php list.p