get static files from S3
This commit is contained in:
parent
0392b78e91
commit
9c1a1b9b36
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -9,4 +9,8 @@ public/js/
|
|||
.sass-cache/
|
||||
|
||||
#node cache
|
||||
node_modules/
|
||||
node_modules/
|
||||
|
||||
#composer
|
||||
public/API/vendor
|
||||
public/API/composer.lock
|
6
public/API/composer.json
Normal file
6
public/API/composer.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"require": {
|
||||
"aws/aws-sdk-php": "^3.181",
|
||||
"symforge/chilkat-php": "9.5.0.66"
|
||||
}
|
||||
}
|
26
public/API/getFile.php
Normal file
26
public/API/getFile.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
include("./lib/config.php");
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$s3Client = new Aws\S3\S3Client([
|
||||
'version' => 'latest',
|
||||
'region' => 'us-east-1',
|
||||
'endpoint' => $S3Server,
|
||||
'use_path_style_endpoint' => true,
|
||||
'credentials' => [
|
||||
'key' => $S3AccessKey,
|
||||
'secret' => $S3SecretKey,
|
||||
],
|
||||
]);
|
||||
|
||||
// Get a command object from the client
|
||||
$command = $s3Client->getCommand('GetObject', [
|
||||
'Bucket' => $S3BucketName,
|
||||
'Key' => $_GET["filename"]
|
||||
]);
|
||||
|
||||
// Create a pre-signed URL for a request with duration of 10 miniutes
|
||||
$presignedRequest = $s3Client->createPresignedRequest($command, '1000 minutes');
|
||||
|
||||
// Get the actual presigned-url
|
||||
echo (string) $presignedRequest->getUri();
|
|
@ -14,3 +14,8 @@ $footerMaxPost = 5;
|
|||
$homeMaxPost = 3;
|
||||
|
||||
$trackURL = "";
|
||||
|
||||
$S3Server = "";
|
||||
$S3AccessKey = "";
|
||||
$S3SecretKey = "";
|
||||
$S3BucketName = "";
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue