Generates a time-limited and/or query signed request for a private file with additional optional restrictions.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The hostname of the distribution. Obtained from |
|
|
Required |
The file name of the object. Query parameters can be included. You can use multicharacter match wild cards () or a single-character match wild card (?) anywhere in the string. |
|
|
Required |
The expiration time expressed either as a number of seconds since UNIX Epoch, or any string that |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
The file URL with authentication parameters. |
Examples
Get a private object URL.
- Ensure you have the OpenSSL PHP Extension installed.
- In your AWS Account Settings, create a new CloudFront key-pair to give you a key-pair ID, and download a *.pem private key.
- Add the key-pair ID and the contents of your private key to your
config.inc.php
file. - In Amazon CloudFront, Create a new origin access identity (OAI).
- In Amazon S3, set the object permissions as Owner = Full Control and the OAI ID = Read
- Call
get_private_object_url()
.
$cdn = new AmazonCloudFront(); $response = $cdn->get_private_object_url( 'dabcdefghijklxyz.cloudfront.net', 'video/folder with spaces/såmplé.mp4', '5 minutes' ); // Success? var_dump($response);
See Also
Source
Method defined in services/cloudfront.class.php | Toggle source view (93 lines) | View on GitHub