Using Pre-Signed URL PHP with Stook

You can create pre-signed URLs for any Stook operation using the getCommand method. Then by createPresignedRequest () method, you can call these URLs.

Sample Code

1.	require 'vendor/autoload.php';  
2.	
3.	use Aws\S3\S3Client;  
4.	use Aws\S3\Exception\S3Exception;
5.	
6.	$bucket = "bucket";  
7.	$key = "mykey"; 
8.	
9.	//Create a S3Client  
10.	$s3 = new Aws\S3\S3Client([
11.	   'endpoint' => 'https://customername.mncdn.com',
12.	   'profile' => 'medianova',
13.	   'version' => 'latest',
14.	   'region' => 'us-east-1',
15.	   'use_path_style_endpoint' => true
16.	]);
17.	
18.	$cmd = $s3->getCommand('GetObject', [
19.	   'Bucket' => $bucket,
20.	   'Key' => $key,
21.	]);
22.	$request = $s3->createPresignedRequest($cmd,'+20 minutes');
23.	
24.	$presignedUrl = (string) $request->getUri();  
25.	echo $presignedUrl;

If you have a problem with your account or application, you can email support@medianova.com  or reach our support team by phone +90 212 275 5456.

Medianova Team