Ceph Object Gateway S3 API 接口问题PHP
<?php<br />define('AWS_KEY', '账号');<br />define('AWS_SECRET_KEY', '密码');<br />//define('AWS_CANONICAL_ID', 'your DHO Username');<br />//define('AWS_CANONICAL_NAME', 'Also your DHO Username!');<br />$HOST = 'IP';<br />// require the amazon sdk for php library<br />require_once 'sdk-1.6.2/sdk.class.php';<br /><br />// Instantiate the S3 class and point it at the desired host<br />$Connection = new AmazonS3(array(<br /> 'key' => AWS_KEY,<br /> 'secret' => AWS_SECRET_KEY,<br /> //'canonical_id' => AWS_CANONICAL_ID,<br /> //'canonical_name' => AWS_CANONICAL_NAME,<br />));<br />$Connection->set_hostname($HOST);<br />$Connection->allow_hostname_override(false);<br /><br />// Set the S3 class to use objects.dreamhost.com/bucket<br />// instead of bucket.objects.dreamhost.com<br />$Connection->enable_path_style();<br />echo "测试1";<br />$ListResponse = $Connection->list_buckets();<br />echo "测试2";<br />$Buckets = $ListResponse->body->Buckets->Bucket;<br />foreach ($Buckets as $Bucket) {<br /> echo $Bucket->Name . "\t" . $Bucket->CreationDate . "<br>";<br />}