Here is my code:
use Aws\S3\S3Client;
use Aws\Exception\AwsException;
define('AWS_KEY', '****');
define('AWS_SECRET_KEY', '****');
// Instantiate the S3 class and point it at the desired host
$client = S3Client::factory(array(
'region' => 'us-east-1',
'version' => 'latest',
'endpoint' => "https://website.com",
'credentials' => [
'key' => AWS_KEY,
'secret' => AWS_SECRET_KEY
],
// Set the S3 class to use objects.dreamhost.com/bucket
// instead of bucket.objects.dreamhost.com
'use_path_style_endpoint' => true
));
$listResponse = $client->listBuckets();
print_r($listResponse);
$buckets = $listResponse['Buckets'];
foreach ($buckets as $bucket) {
echo $bucket['Name'] . "\t" . $bucket['CreationDate'] . "\n";
}
And here is the response I get:
Aws\Result Object ( [data:Aws\Result:private] => Array ( [@metadata] => Array ( [statusCode] => 200 [effectiveUri] => https://website.com/ [headers] => Array ( [server] => nginx/1.16.1 [date] => Fri, 22 Jan 2021 04:57:56 GMT [content-type] => text/html; charset=UTF-8 [transfer-encoding] => chunked [connection] => keep-alive [x-xss-protection] => 1; mode=block [x-frame-options] => SAMEORIGIN [x-content-type-options] => nosniff [expect-ct] => enforce, max-age=300, report-uri='https://www.website.com' [x-cache] => BYPASS [strict-transport-security] => max-age=31536000 )
[transferStats] => Array
(
[http] => Array
(
[0] => Array
(
)
)
)
)
)
[monitoringEvents:Aws\Result:private] => Array
(
)
)
I can't seem to get Buckets to appear (I currently have on bucket on Amazon S3).
Any suggestions as to why it won't show? Thanks ahead.