How to Use Pre-Signed URL in PHP with Stook
Generate and use pre-signed URLs in PHP for accessing objects in Medianova Stook Object Storage.
Prerequisites
Example: Generate a Pre-Signed URL
require 'vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;
$bucket = "bucket";
$key = "mykey";
// Create a S3Client
$s3 = new Aws\S3\S3Client([
'endpoint' => 'https://customername.mncdn.com',
'profile' => 'medianova',
'version' => 'latest',
'region' => 'us-east-1',
'use_path_style_endpoint' => true
]);
$cmd = $s3->getCommand('GetObject', [
'Bucket' => $bucket,
'Key' => $key,
]);
$request = $s3->createPresignedRequest($cmd, '+20 minutes');
$presignedUrl = (string) $request->getUri();
echo $presignedUrl;How It Works
Troubleshooting / FAQ
References
PreviousHow do I use Stook with the AWS Java SDK?NextHow to Use Pre-Signed URL in Node.js with Stook
Last updated
Was this helpful?