jeudi 16 avril 2015

why do i get "acces denied" when trying to use file_get_contents() in a file in a bucket s3?

i'm trying to use php functions for reading and writing files in a s3 bucket,i've tried uploading some files and it works fine , but when trying this code :



ini_set('display_errors', 1);
require 'vendor/autoload.php';

use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;

// Instantiate an S3 client
$client = S3Client::factory(array(
'key' => 'key',
'secret' => 'secret-key',
'region' => 'region'
));

$client->registerStreamWrapper();
$data = file_get_contents("http://s3bucket_name/file.txt");
echo $data;


i get this error :



AccessDenied Access Denied


plz any idea. Thanks.





Aucun commentaire:

Enregistrer un commentaire