Am using below third party API in my project development
http://undesigned.org.za/2007/10/22/amazon-s3-php-class
I have done all task like upload, delete, bucket-list, object-list with this API,
but one of major task to create object download link form a bucket is hazy.
Official Amazon API has :
get_object_url ( $bucket, $filename, $preauth, $opt )
to get any object’s URL, but with above API is lack of method and documentation.
Its shows following error with this code when i click on download link:
Code
<h1>All uploaded files</h1>
<?php
// Get the contents of our bucket
$contents = $s3->getBucket("mybucket");
foreach ($contents as $file){
$fname = $file['name'];
$furl = "http://mybucket.s3.amazonaws.com/".$fname;
//output a link to the file
echo "<a href=\"$furl\">$fname</a><br />";
}
?>
Error
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>5A23C56B55611736</RequestId>
<HostId>m2V2NlI19zgGPq0o4lXmIfod2BeQZIkuH4Yu651372cE/hfa9BkLdV8y3LlYjtw1</HostId>
</Error>
If someone has any idea or experience with this API then suggest me. Thanks
So you are using : http://undesigned.org.za/2007/10/22/amazon-s3-php-class S3 class, and want to create download link of an object from bucket
You should try this:
This download link will expire after 1hr(3600sec.), you can extend expire time by the last parameter to increment it.