Amazon Simple Storage Service (http://aws.amazon.com/s3)
2010.01.10
2006-2010 Ryan Parman, Foleeo, Inc., and contributors.
| Simplified BSD License | http://opensource.org/licenses/bsd-license.php |
| CloudFusion | http://getcloudfusion.com |
| Amazon S3 | http://aws.amazon.com/s3 |
Specify the US location.
Specify the US location.
Specify the European Union (EU) location.
ACL: Owner-only read/write.
ACL: Owner read/write, public read.
ACL: Public read/write.
ACL: Owner read/write, authenticated read.
When applied to a bucket, grants permission to list the bucket. When applied to an object, this grants permission to read the object data and/or metadata.
When applied to a bucket, grants permission to create, overwrite, and delete any object in the bucket. This permission is not supported for objects.
Grants permission to read the ACL for the applicable bucket or object. The owner of a bucket or object always has this permission implicitly.
Gives permission to overwrite the ACP for the applicable bucket or object. The owner of a bucket or object always has this permission implicitly. Granting this permission is equivalent to granting FULL_CONTROL because the grant recipient can make any changes to the ACP.
Provides READ, WRITE, READ_ACP, and WRITE_ACP permissions. It does not convey additional rights and is provided only for convenience.
The “AuthenticatedUsers” group for access control policies.
The “AllUsers” group for access control policies.
The “LogDelivery” group for access control policies.
PCRE: Match all items
Container for all Amazon S3-related methods. Inherits additional methods from CloudFusion.
CloudFusion
The request URL.
The virtual host setting.
The base XML elements to use for access control policy methods.
The base XML elements to use for logging methods.
public function __construct( $key = null, $secret_key = null )
The constructor
public
| key | string (Optional) Your Amazon API Key. If blank, it will look for the AWS_KEY constant. |
| secret_key | string (Optional) Your Amazon API Secret Key. If blank, it will look for the AWS_SECRET_KEY constant. |
boolean false if no valid values are set, otherwise true.
public function authenticate( $bucket, $opt = null, $location = null, $redirects = 0 )
Authenticates a connection to S3. This should not be used directly unless you’re writing custom methods for this class.
public
| bucket | string (Required) The name of the bucket to be used. |
| opt | array (Optional) Associative array of parameters for authenticating. See the individual methods for allowed keys. |
| location | string (Do Not Use) Used internally by this function on occasions when S3 returns a redirect code and it needs to call itself recursively. |
| redirects | integer (Do Not Use) Used internally by this function on occasions when S3 returns a redirect code and it needs to call itself recursively. |
ResponseCore object
http://docs.amazonwebservices.com
public function set_vhost( $vhost )
Use this virtual host instead of the normal bucket.s3.amazonaws.com domain.
public
| vhost | string (Required) The hostname to use instead of bucket.s3.amazonaws.com. |
void
| Virtual Hosting of Buckets | http://docs.amazonwebservices.com |
public function create_bucket( $bucket, $locale = null, $returnCurlHandle = null )
The bucket holds all of your objects, and provides a globally unique namespace in which you can manage the keys that identify objects. A bucket can hold any number of objects.
public
| bucket | string (Required) The name of the bucket to be used. |
| locale | string (Optional) Sets the preferred geographical location for the bucket. Accepts S3_LOCATION_US or S3_LOCATION_EU. Defaults to S3_LOCATION_US. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
public function get_bucket( $bucket, $opt = null )
Referred to as “GET Bucket” in the AWS docs, but implemented here as AmazonS3::list_objects(). Therefore, this is an alias of list_objects().
| Related | create_bucket(), head_bucket(), delete_bucket(), list_objects() |
public function get_bucket_locale( $bucket, $returnCurlHandle = null )
Lists the location constraint of the bucket. U.S.-based buckets have no response.
public
| bucket | string (Required) The name of the bucket to be used. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
public function head_bucket( $bucket, $returnCurlHandle = null )
Reads only the HTTP headers of a bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | create_bucket(), get_bucket(), delete_bucket() |
public function if_bucket_exists( $bucket )
Checks whether this bucket already exists in your account or not.
public
| bucket | string (Required) The name of the bucket to be used. |
boolean Whether the bucket exists or not.
public function delete_bucket( $bucket, $force = false, $returnCurlHandle = null )
Deletes a bucket from your account. All objects in the bucket must be deleted before the bucket itself can be deleted.
public
| bucket | string (Required) The name of the bucket to be used. |
| force | boolean (Optional) Whether to force-delete the bucket and all of its contents. Defaults to false. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object if normal bucket deletion or if forced bucket deletion was successful, a boolean false if the forced deletion was unsuccessful.
| AWS Method | http://docs.amazonwebservices.com |
| Related | create_bucket(), get_bucket(), head_bucket() |
public function copy_bucket( $source_bucket, $dest_bucket, $acl = S3_ACL_PRIVATE )
Copies the contents of a bucket into a new bucket.
public
| source_bucket | string (Required) The name of the source bucket. |
| dest_bucket | string (Required) The name of the destination bucket. |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
ResponseCore object
| Related | copy_object(), rename_bucket(), list_buckets() |
public function rename_bucket( $source_bucket, $dest_bucket )
Renames a bucket by making a copy and deleting the original.
public
| source_bucket | string (Required) The name of the source bucket. |
| dest_bucket | string (Required) The name of the destination bucket. |
ResponseCore object
| Related | rename_object(), copy_bucket(), list_buckets() |
public function get_bucket_size( $bucket )
Gets the number of files in the bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
integer The number of files in the bucket.
| Related | get_bucket_filesize() |
public function get_bucket_filesize( $bucket, $friendly_format = false )
Gets the file size of the contents of the bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| friendly_format | boolean (Optional) Whether to format the value to 2 decimal points using the largest possible unit (i.e. 3.42 GB). |
integer | string The number of bytes as an integer, or the friendly format as a string.
| Related | get_bucket_size(), get_object_filesize() |
public function list_buckets( $returnCurlHandle = null )
Gets a list of all of the buckets on the S3 account.
public
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | get_bucket_list() |
public function get_bucket_list( $pcre = null )
ONLY lists the bucket names, as an array, on the S3 account.
public
| pcre | string (Optional) A Perl-Compatible Regular Expression (PCRE) to filter the names against. |
array The list of matching bucket names.
| Related | list_buckets() |
public function get_bucket_acl( $bucket, $returnCurlHandle = null )
Gets the ACL settings for a bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | set_object_acl(), set_bucket_acl(), get_object_acl() |
public function set_bucket_acl( $bucket, $acl = S3_ACL_PRIVATE, $returnCurlHandle = null )
Sets the ACL settings for a bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Alternatively, an array of associative arrays. Each associative array contains an ‘id’ and a ‘permission’. Defaults to S3_ACL_PRIVATE. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | set_object_acl(), get_bucket_acl(), get_object_acl() |
public function create_object( $bucket, $opt = null )
Once you have a bucket, you can start storing objects in it. Objects are stored using the HTTP PUT method. Each object can hold up to 5 GB of data. When you store an object, S3 streams the data to multiple storage servers in multiple data centers to ensure that the data remains available in the event of internal network or hardware failure.
public
| bucket | string (Required) The name of the bucket to be used. |
| opt | array (Required) Associative array of parameters which can have the following keys: |
| filename | string (Required) The filename for the object. |
| body | string (Required) The data to be stored in the object. |
| contentType | string (Required) The type of content that is being sent in the body. |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
| headers | array (Optional) Standard HTTP headers to send along in the request. |
| meta | array (Optional) Associative array of key-value pairs. Represented by x-amz-meta-: Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
public function get_object( $bucket, $filename, $opt = null )
Reads the contents of an object within a bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| opt | array (Optional) Associative array of parameters which can have the following keys: |
| lastmodified | string (Optional) The LastModified header passed in from a previous request. If used, requires ‘etag’ as well. Will return a 304 if file hasn’t changed. |
| etag | string (Optional) The ETag header passed in from a previous request. If used, requires ‘lastmodified’ as well. Will return a 304 if file hasn’t changed. |
| range | string (Optional) A range of bytes to fetch from the file. Useful for downloading partial bits or completing incomplete files. Range notated with a hyphen (e.g. 0-10485759). Defaults to the complete file. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | create_object(), head_object(), delete_object() |
public function head_object( $bucket, $filename, $returnCurlHandle = null )
Reads only the HTTP headers of an object within a bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | create_object(), get_object(), delete_object(), if_object_exists() |
public function if_object_exists( $bucket, $filename )
Checks whether this object already exists in this bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
boolean Whether the object exists or not.
| Related | head_object() |
public function delete_object( $bucket, $filename, $returnCurlHandle = null )
Deletes an object from within a bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | create_object(), get_object(), head_object(), delete_all_objects() |
public function delete_all_objects( $bucket, $pcre = S3_PCRE_ALL )
Delete all of the objects inside the specified bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| pcre | string (Optional) A Perl-Compatible Regular Expression (PCRE) to filter the names against. Defaults to S3_PCRE_ALL. |
boolean Determines the success of deleting all files.
| Related | delete_object() |
public function list_objects( $bucket, $opt = null )
Lists the objects in a bucket. Provided as the ‘GetBucket’ action in Amazon’s REST API.
public
| bucket | string (Required) The name of the bucket to be used. |
| opt | array (Required) Associative array of parameters which can have the following keys: |
| prefix | string (Optional) Restricts the response to only contain results that begin with the specified prefix. |
| marker | string (Optional) It restricts the response to only contain results that occur alphabetically after the value of marker. |
| maxKeys | string (Optional) Limits the number of results returned in response to your query. Will return no more than this number of results, but possibly less. |
| delimiter | string (Optional) Unicode string parameter. 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. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| List Keys | http://docs.amazonwebservices.com |
| Related | get_bucket(), get_object_list() |
public function get_object_filesize( $bucket, $filename, $friendly_format = false )
Gets the file size of the object.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| friendly_format | boolean (Optional) Whether to format the value to 2 decimal points using the largest possible unit (i.e. 3.42 GB). |
integer | string The number of bytes as an integer, or the friendly format as a string.
| Related | get_bucket_filesize() |
public function get_object_list( $bucket, $opt = null )
ONLY lists the object filenames from a bucket.
public
| bucket | string (Required) The name of the bucket to be used. |
| opt | array (Required) Associative array of parameters which can have the following keys: |
| prefix | string (Optional) Restricts the response to only contain results that begin with the specified prefix. |
| marker | string (Optional) It restricts the response to only contain results that occur alphabetically after the value of marker. |
| maxKeys | string (Optional) Limits the number of results returned in response to your query. Will return no more than this number of results, but possibly less. |
| delimiter | string (Optional) Unicode string parameter. 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. |
| pcre | string (Optional) A Perl-Compatible Regular Expression (PCRE) to filter the names against. This is applied AFTER any native S3 filtering from ‘prefix’, ‘marker’, ‘maxKeys’, or ‘delimiter’. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
array The list of matching object names.
| AWS Method | http://docs.amazonwebservices.com |
| List Keys | http://docs.amazonwebservices.com |
| Related | get_bucket_list(), list_objects() |
public function copy_object( $source_bucket, $source_filename, $dest_bucket, $dest_filename, $opt = null )
Copies an object to a new location, whether in the same locale/bucket or otherwise.
public
| source_bucket | string (Required) The name of the bucket that contains the source file. |
| source_filename | string (Required) The source filename that you want to copy. |
| dest_bucket | string (Required) The name of the bucket that you want to copy the file to. |
| dest_filename | string (Required) The filename that you want to give to the copy. |
| opt | array (Required) Associative array of parameters which can have the following keys: |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
| headers | array (Optional) Standard HTTP headers to send along in the request. |
| meta | array (Optional) Associative array of key-value pairs. Represented by x-amz-meta-: Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB. |
| metadataDirective | string (Optional) Accepts either COPY or REPLACE. You will likely never need to use this, as it manages itself with no issues. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
public function update_object( $bucket, $filename, $opt )
Updates an existing object with new content or settings.
public
| bucket | string (Required) The name of the bucket that contains the source file. |
| filename | string (Required) The source filename that you want to update. |
| opt | array (Required) Associative array of parameters which can have the following keys: |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
| headers | array (Optional) Standard HTTP headers to send along in the request. |
| meta | array (Optional) Associative array of key-value pairs. Represented by x-amz-meta-: Any header starting with this prefix is considered user metadata. It will be stored with the object and returned when you retrieve the object. The total size of the HTTP request, not including the body, must be less than 4 KB. |
| metadataDirective | string (Optional) Accepts either COPY or REPLACE. You will likely never need to use this, as it manages itself with no issues. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
public function duplicate_object( $bucket, $source_filename, $dest_filename, $acl = S3_ACL_PRIVATE )
Identical to copy_object(), except that it only copies within a single bucket.
public
| bucket | string (Required) The name of the bucket that contains the file. |
| source_filename | string (Required) The source filename that you want to copy. |
| dest_filename | string (Required) The filename that you want to give to the copy. |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
ResponseCore object
| Related | copy_object(), move_object(), rename_object() |
public function move_object( $source_bucket, $source_filename, $dest_bucket, $dest_filename, $acl = S3_ACL_PRIVATE )
Moves an object to a new location, whether in the same locale/bucket or otherwise.
public
| source_bucket | string (Required) The name of the bucket that contains the source file. |
| source_filename | string (Required) The source filename that you want to copy. |
| dest_bucket | string (Required) The name of the bucket that you want to copy the file to. |
| dest_filename | string (Required) The filename that you want to give to the copy. |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
array ResponseCore objects for the copy and the delete.
| Related | copy_object(), duplicate_object(), rename_object() |
public function rename_object( $bucket, $source_filename, $dest_filename, $acl = S3_ACL_PRIVATE )
Identical to move_object(), except that it only moves within a single bucket.
public
| bucket | string (Required) The name of the bucket that contains the file. |
| source_filename | string (Required) The source filename that you want to copy. |
| dest_filename | string (Required) The filename that you want to give to the copy. |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
ResponseCore object
| Related | copy_object(), duplicate_object(), move_object() |
public function get_object_acl( $bucket, $filename, $returnCurlHandle = null )
Gets the ACL settings for a object.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | set_object_acl(), set_bucket_acl(), get_bucket_acl() |
public function set_object_acl( $bucket, $filename, $acl = S3_ACL_PRIVATE, $returnCurlHandle = null )
Sets the ACL settings for a object.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Alternatively, an array of associative arrays. Each associative array contains an ‘id’ and a ‘permission’. Defaults to S3_ACL_PRIVATE. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | set_bucket_acl(), get_bucket_acl(), get_object_acl() |
public function get_logs( $bucket )
Get the access logs associated with a given bucket.
public
| bucket | string (Required) The name of the bucket to be used. Pass null if using set_vhost(). |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | get_logs(), enable_logging(), disable_logging() |
public function enable_logging( $bucket, $target_bucket, $target_prefix, $users = null )
Enable access logging.
public
| bucket | string (Required) The name of the bucket to be log. Pass null if using set_vhost(). |
| target_bucket | string (Required) The name of the bucket to store the logs in. |
| target_prefix | string (Required) The prefix to give to the log filenames. |
| users | array (Optional) Any non-owner users to give access to. Set as an array of key-value pairs: the email address (must be tied to an AWS account) is the key, and the permission is the value. Allowable permissions are S3_GRANT_READ, S3_GRANT_WRITE, S3_GRANT_READ_ACP, S3_GRANT_WRITE_ACP, and S3_GRANT_FULL_CONTROL. |
ResponseCore object
public function disable_logging( $bucket )
Disable access logging.
public
| bucket | string (Required) The name of the bucket to be used. Pass null if using set_vhost(). |
ResponseCore object
| AWS Method | http://docs.amazonwebservices.com |
| Related | get_logs(), enable_logging(), disable_logging() |
public function store_remote_file( $remote_file, $bucket, $filename, $opt = null )
Takes an existing remote URL, stores it to S3, and returns a URL for the stored copy. For creating new objects in S3, use the create_object() method.
public
| remote_file | string (Required) The full URL of the file to store on the S3 service. |
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| opt | array (Required) Associative array of parameters which can have the following keys: |
| acl | string (Optional) One of the following options: S3_ACL_PRIVATE, S3_ACL_PUBLIC, S3_ACL_OPEN, or S3_ACL_AUTH_READ. Defaults to S3_ACL_PRIVATE. |
| overwrite | boolean (Optional) If set to true, checks to see if the file exists and will overwrite the old data with new data. Defaults to false. |
string The S3 URL for the uploaded file. Returns null if unsuccessful.
public function change_content_type( $bucket, $filename, $contentType, $returnCurlHandle = null )
Changes the content type for an existing object.
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| contentType | string (Required) The content-type to apply to the object. |
| returnCurlHandle | boolean (Optional) A private toggle that will return the CURL handle for the request rather than actually completing the request. This is useful for MultiCURL requests. |
ResponseCore object
public function get_object_url( $bucket, $filename, $qsa = 0, $torrent = false )
Gets the web-accessible URL for the file (assuming you’ve set the ACL settings to S3_ACL_PUBLIC).
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| qsa | integer (Optional) How many seconds should the query string authenticated URL work for? Only generates query string authentication parameters if value is greater than 0. Defaults to 0. |
| torrent | boolean (Optional) Whether to return the torrent version of the URL or not. Defaults to false. |
string The file URL (with authentication and/or torrent parameters if requested).
| Query String Authentication | http://docs.amazonwebservices.com |
| Related | get_torrent_url() |
public function get_torrent_url( $bucket, $filename, $qsa = 0 )
Gets the web-accessible torrent URL for the file (assuming you’ve set the ACL settings to S3_ACL_PUBLIC).
public
| bucket | string (Required) The name of the bucket to be used. |
| filename | string (Required) The filename for the object. |
| qsa | integer (Optional) How many seconds should the query string authenticated URL work for? Only generates query string authentication parameters if value is greater than 0. Defaults to 0. |
string The torrent URL (with authentication parameters if requested).
| AWS Method | http://docs.amazonwebservices.com |
| Related | get_object_url() |
public function generate_access_policy( $canonical_id, $canonical_name, $users )
Generate the XML to be used for the Access Control Policy.
public
| canonical_id | string (Required) The Canonical ID for the Owner. Use the AWS_CANONICAL_ID constant or the ‘id’ value from get_canonical_user_id(). |
| canonical_name | string (Required) The Canonical Display Name for the Owner. Use the AWS_CANONICAL_NAME constant or the ‘display_name’ value from get_canonical_user_id(). |
| users | array (Optional) Array of associative arrays. Each associative array contains an ‘id’ and a ‘permission’. |
string Access Control Policy XML.
| AWS Method | http://docs.amazonwebservices.com |
public function get_canonical_user_id()
Obtains the CanonicalUser ID and DisplayName from the server.
public
array The id and display_name values.