SDK for PHP 3.x

UrlSigner
in package

Creates signed URLs for Amazon CloudFront resources.

Table of Contents

Methods

__construct()  : mixed
getSignedUrl()  : string
Create a signed Amazon CloudFront URL.

Methods

__construct()

public __construct( $keyPairId,  $privateKey) : mixed
Parameters
$keyPairId :

string ID of the key pair

$privateKey :

string Path to the private key used for signing

Tags
throws
RuntimeException

if the openssl extension is missing

throws
InvalidArgumentException

if the private key cannot be found.

getSignedUrl()

Create a signed Amazon CloudFront URL.

public getSignedUrl(string $url[, string|int|null $expires = null ][, string $policy = null ]) : string

Keep in mind that URLs meant for use in media/flash players may have different requirements for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed

  • mp4:, some require you to add "/cfx/st" into your URL).
Parameters
$url : string

URL to sign (can include query string string and wildcards)

$expires : string|int|null = null

UTC Unix timestamp used when signing with a canned policy. Not required when passing a custom $policy.

$policy : string = null

JSON policy. Use this option when creating a signed URL for a custom policy.

Tags
throws
InvalidArgumentException

if the URL provided is invalid

link
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html
Return values
string

The file URL with authentication parameters

On this page