I am learning Amazon S3 using S3 PHP Class. I have uploaded my all files to my S3 bucket, now I want to create links for each available file in my bucket.
Will the following function work for me?
public static function getAuthenticatedURL($bucket, $uri, $lifetime, $hostBucket = false, $https = false)
{
}
$s3 = new S3('access-key', 'secret-key');
$s3->getAuthenticatedURL($bucket, $uri, $lifetime, $hostBucket = false, $https = false);
Or another function like get_object_url, but get_object_url() not in my S3 class.
I am using Undesigned’s Amazon S3 PHP class.
If you want the public to access the bucket, it is as simple as
http://[YourBucketName].s3.amazonaws.com/%5BYourFileName%5D
So long as you set permissions correctly.
If you’re worried about download abuse, you’ll want an authenticated URL (which I guess you want from your code sammple). In which case, I suggest you use the Amazon SDK: http://aws.amazon.com/sdkforphp/ as it contains examples of what you need.
Docs: http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.S3.S3Client.html#_getObjectUrl