Example #1
Retrieving all buckets from a S3 account
The following examples illustrates how to retrieve all buckets of a given S3 account. All you need to replace in the snippet are the $key and $secret variables.
<?php
require_once 'Services/Amazon/S3.php';
$key = 'your key';
$secret = 'your secret';
$s3 = Services_Amazon_S3::getAccount($key, $secret);
echo '<ul>';
foreach ($s3->getBuckets() as $bucket) {
echo "<li>{$bucket->name}</li>";
}
echo '</ul>';
?>