使用Zend的s3库在Amazon中创建存储桶时出现以下错误:
AmazonS3 367 SignatureDoesNotMatch。我们计算的请求签名与您提供的签名不匹配。检查您的密钥和签名方法。
以下是代码:
require_once('Zend/Service/Amazon/S3.php');
$awsKey = "XXXXXXXXXXXXXXXXX";
$awsSecretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxX";
$bucket = "my_bucket";
$s3 = new Zend_Service_Amazon_S3($awsKey,$awsSecretKey);
$s3->createBucket($bucket);
$buckets = $s3->getBuckets();
foreach ($buckets as $bucket) {
$list = $s3->getObjectsByBucket($bucket);
}
$s3->putObject("$bucket/myobject", "somedata");
echo $s3->getObject("$bucket/myobject");