Gets a simplified list of Amazon S3 object file names contained in a bucket.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The name of the bucket to use. |
|
|
Optional |
An associative array of parameters that can have the following keys: < ul> delimiter - string - Optional - Keys that contain the same string between the prefix and the first occurrence of the delimiter will be rolled up into a single result element in the CommonPrefixes collection.marker - string - Optional - Restricts the response to contain results that only occur alphabetically after the value of the marker.max-keys - integer - Optional - The maximum number of results returned by the method call. The returned list will contain no more results than the specified value, but may return less. A value of zero is treated as if you did not specify max-keys.pcre - string - Optional - A Perl-Compatible Regular Expression (PCRE) to filter the names against. This is applied only AFTER any native Amazon S3 filtering from specified prefix , marker , max-keys , or delimiter values are applied.prefix - string - Optional - Restricts the response to contain results that begin only with the specified prefix.curlopts - array - Optional - A set of values to pass directly into curl_setopt() , where the key is a pre-defined CURLOPT_* constant. |
Returns
Type |
Description |
---|---|
The list of matching object names. If there are no results, the method will return an empty array. |
Examples
Get a list of all filenames in a bucket.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); $response = $s3->get_object_list($bucket); // Success? var_dump(gettype($response) === 'array');Result:
bool(true)
Get a list of all filenames in a bucket that match a given PCRE regular expression pattern.
// Instantiate the class $s3 = new AmazonS3(); $bucket = 'my-bucket' . strtolower($s3->key); // Get all filenames that match this pattern $response = $s3->get_object_list($bucket, array( 'pcre' => '/pdf/i' )); // Success? var_dump(gettype($response) === 'array');Result:
bool(true)
Related Methods
See Also
Source
Method defined in services/s3.class.php | Toggle source view (83 lines) | View on GitHub