-
Notifications
You must be signed in to change notification settings - Fork 17
/
example.php
executable file
·62 lines (46 loc) · 1.88 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
require_once("vendor/autoload.php");
try {
$selectelStorage = new easmith\selectel\storage\SelectelStorage("user", "pass");
echo "\n\nCreate Container:\n";
$container = $selectelStorage->createContainer('selectel', array("X-Container-Meta-Type: public"));
// print_r($container->getInfo());
echo "Containers list\n";
$containerList = $selectelStorage->listContainers();
// print_r($containerList);
echo "\n\nContainer Info:\n";
$cInfo = $selectelStorage->getContainer($containerList[0])->getInfo();
// print_r($cInfo);
echo "\n\nCreate directory:\n";
$container = $selectelStorage->getContainer($containerList[0]);
$container->createDirectory('php/test');
echo "\n\nDirectories:\n";
$dirList = $container->listFiles($limit = 10000, $marker = null, $prefix = null, $path = "");
// print_r($dirList);
echo "\n\nPutting File:\n";
$res = $container->putFile(__FILE__, 'example.php');
print_r($res);
echo "\n\nFiles in directory:\n";
$fileList = $container->listFiles($limit = 10000, $marker = null, $prefix = null, $path = 'php/');
print_r($fileList);
echo "\n\nFile info:\n";
$fileInfo = $container->getFileInfo('example.php');
print_r($fileInfo);
echo "\n\nGetting file (base64):\n";
$file = $container->getFile($fileInfo['name']);
print_r($file);
echo "\n\nCopy: \n";
$copyRes = $container->copy('example.php', 'php/test/Examples_copy.php5');
print_r($copyRes);
echo "\n\nDelete: \n";
$deleteRes = $container->delete('example.php');
print_r($deleteRes);
$deleteRes = $container->delete('php/test/Examples_copy.php5');
print_r($deleteRes);
echo "\n\nAccountMetaTempURL: \n";
$MetaTempURLKeyRes = $container->setAccountMetaTempURLKey("test");
print_r($MetaTempURLKeyRes);
echo "\n\n";
} catch (Exception $e) {
print_r($e->getTrace());
}