Я пытаюсь подключиться к корзине AWS S3 и перечислить все объекты внутри корзины.
Когда я перехожу на страницу, я получаю ошибку 500, которая говорит:
Object of class Generator could not be converted to string
Я подтвердил, что мои учетные данные IAM верны, и в корзине много объектов.
Вот мой код:
//Include the AWS SDK using the Composer autoloader.
require 'awssdk/aws-autoloader.php';
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
// AWS Info
$bucketName = 'pipedemail';
$IAM_KEY = '*****';
$IAM_SECRET = '******';
// Connect to AWS
try {
// and on creation. us-east-2 is Ohio, us-east-1 is North Virgina
$s3 = S3Client::factory(
array(
'credentials' => array(
'key' => $IAM_KEY,
'secret' => $IAM_SECRET
),
'version' => 'latest',
'region' => 'us-east-1'
)
);
} catch (Exception $e) {
// We use a die, so if this fails. It stops here. Typically this is a REST call so this would
// return a json object.
die("Error: " . $e->getMessage());
}
// Use the high-level iterators (returns ALL of your objects).
$objects = $s3->getIterator('ListObjects', array('Bucket' => $bucketName));
Строка, выдающая ошибку 500:
$objects = $s3->getIterator('ListObjects', array('Bucket' => $bucketName));
Я не знаю, как это исправить.