list_buckets ( $opt )

Gets a list of all buckets contained in the caller’s Amazon S3 account.

Access

public

Parameters

Parameter

Type

Required

Description

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • preauth - integer|string - Optional - Specifies that a presigned URL for this request should be returned. May be passed as a number of seconds since UNIX Epoch, or any string compatible with strtotime().
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

List all buckets under your account.

// Instantiate the class
$s3 = new AmazonS3();

$response = $s3->list_buckets();

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/s3.class.php | Toggle source view (7 lines) | View on GitHub

public function list_buckets($opt = null)
{
    if (!$opt) $opt = array();
    $opt['verb'] = 'GET';

    return $this->authenticate('', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback