mardi 6 janvier 2015

Undefined variable: bucketname (View:

I am trying to connect up an aws bucket to read the contents of the s3 bucket into a database I have set up the connection and it returns the bucket names but I now want the contents of a particular bucket


here is what I have



use Aws\S3\S3Client;

// Establish connection with an S3 client.
$client = S3Client::factory(array(

'key' => AWS_KEY,
'secret' => AWS_SECRET_KEY
));

// list owned buckets


$blist = $client->listBuckets();
echo " Buckets belonging to " . $blist['Owner']['ID'] . ":\n";
foreach ($blist['Buckets'] as $b) {
echo "{$b['Name']}\t{$b['CreationDate']}\n";
}

//view contents

$o_iter = $client->getIterator('ListObjects', array(
'Bucket' => $bucketname
));
foreach ($o_iter as $o) {
echo "{$o['Key']}\t{$o['Size']}\t{$o['LastModified']}\n";
}


for reference I got the above from here :


http://ift.tt/1iWxAUu





Aucun commentaire:

Enregistrer un commentaire