Last active
August 29, 2015 14:17
-
-
Save RWhar/e57a04ce4fe3da79a3d4 to your computer and use it in GitHub Desktop.
Signed S3 Links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Requires | |
* "aws/aws-sdk-php": "2.7.25", | |
*/ | |
use Aws\Common\Credentials\Credentials; | |
use Aws\S3\S3Client; | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
/** | |
* Get pre-signed download URL's | |
*/ | |
$awsCredentials = new Credentials('...', '...'); | |
$s3 = S3Client::factory( | |
['credentials' => $awsCredentials] | |
); | |
$command = $s3->getCommand('GetObject', [ | |
'Bucket' => 'MyBucket', | |
'Key' => 'original.txt', | |
'ResponseContentDisposition' => 'attachment; filename="different.txt"' | |
]); | |
$presignedUrl = $command->createPresignedUrl('+10minutes'); | |
var_dump($presignedUrl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment