jeudi 26 février 2015

AWS PHP SDK ~ Why am I getting this error "The command must be prepared before retrieving the request"

I am using the latest PHP AWS SDK... I seem to be running into this problem in certain circumstances... for example:



require 'aws-autoloader.php';
use Aws\S3\S3Client;

$client = S3Client::factory(array(
'key' => <skey>,
'secret' => <secret>
));

$key = $_GET['key'];

try {

$client -> copyObject(array(
'ACL' => "private",
'Bucket' => "<bucket>",
'Key' => "{$key}-copy",
'CopySource' => "<bucket>/{$key}",
'ContentType' => "text/html",
'CacheControl' => "max-age=1, private",
'MetadataDirective' => "REPLACE"
));

} catch (Exception $e) {
echo json_encode($e->getMessage());
}

?>


Why am I getting this error, "The command must be prepared before retrieving the request?"





1 commentaire: