get_torrent_url ( $bucket, $filename, $preauth )

Gets the web-accessible URL to a torrent of the Amazon S3 object. The Amazon S3 object’s access control list settings (ACL) MUST be set to ACL_PUBLIC for a valid URL to be returned.

Access

public

Parameters

Parameter

Type

Required

Description

$bucket

string

Required

The name of the bucket to use.

$filename

string

Required

The file name for the object.

$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().

Returns

Type

Description

string

The torrent URL, with authentication parameters if requested.

Examples

Get the torrent URL for an object.

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

// Get the URL
$url = $s3->get_torrent_url('my-bucket', 'video/sample_public.mp4');

// Success?
var_dump($url);
Result:
string(65) "http://my-bucket.s3.amazonaws.com/video/sample_public.mp4?torrent"

Related Methods

See Also

Source

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

public function get_torrent_url($bucket, $filename, $preauth = 0)
{
    return $this->get_object_url($bucket, $filename, $preauth, array(
        'torrent' => true
    ));
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback