I am trying to download data from a AWS S3 server with their SDK for PHP, but at the second request it crashes with this error:
Fatal error: Uncaught Aws\S3\Exception\AccessDeniedException: AWS Error Code: AccessDenied, Status Code: 403, AWS Request ID...
This is my code:
use Aws\Common\Aws;
$aws = Aws::factory(
array(
'key' => 'my_key',
'secret' => 'my_secret',
)
);
$awsClient = $aws->get('s3');
$result = $awsClient->getObject(
array(
'Bucket' => 'my_bucket',
'Key' => 'my_key',
)
);
The first request works perfectly well, but the second time I call this, it crashes with the above Exception.
Does anyone know how to fix this?
Thank you very much.