How to connect to cloud storage: information for developers

How to connect to cloud storage: information for developers

Links to the SDK:

Example of installing the SDK using PHP composer:

cd public_html/
curl -sS https://getcomposer.org/installer | php
vi composer.json
{
	"require": {
		"php": "7.0.*",
		"php-opencloud/openstack": "^3.0",
		"aws/aws-sdk-php": "2.*"
	}
}

composer.phar install

Example of using the Swift SDK, Keystone (Identity) V3:

swift.php
'https://storage-eu.eudc.cloud/v3',
'region' => 'RegionOne',
'user' => [
	'name' => 'your username',
	'password' => 'your password',
	'domain' => ['id' => 'default' ]
],
'scope' => [
	'project' => [
		'name' => 'your project name',
		'domain' => ['id' => 'default']
		]
	]
]
);

$identity = $openstack->identityV3();
$service = $openstack->objectStoreV1();

Example of using the S3 Compatible:

s3.php
'your key',
'secret' => 'your secret',
'endpoint' => 'https://storage-eu.eudc.cloud',
'signature_version' => 'v2',
)
);

//Listing all S3 Bucket
$result = $client->listBuckets();
print_r($result);

// Create s3 bucket
$result = $client->createBucket(array('Bucket' => "ContainerName/"));
print_r($result);

// Upload file to s3 bucket
$body=file_get_contents("Filename");

If you have any questions, please contact technical support at: support@host-telecom.com

Spelling error report

The following text will be sent to our editors: