ucloud storage php doc
 All Data Structures Namespaces Files Functions Variables
php Namespace Reference

Detailed Description

This is the PHP Cloud Files API. Rackspace¿¡¼­ °ø°³ÇÑ PHP API¸¦ KT ucloud storage »ç¿ëÀ» À§ÇØ ¼öÁ¤ÇÏ¿´½À´Ï´Ù. ÀÎÁõ 󸮸¦ À§ÇÑ ÀÀ´äÇì´õ ¼öÁ¤ API Ãß°¡ ¹× ¼öÁ¤ Authenticate to Cloud Files. The default is to automatically try to re-authenticate if an authentication token expires.

NOTE: Some versions of cURL include an outdated certificate authority (CA) file. This API ships with a newer version obtained directly from cURL's web site (http://curl.haxx.se). To use the newer CA bundle, call the CF_Authentication instance's 'ssl_use_cabundle()' method.

$auth = new CF_Authentication($username, $api_key); $auth->ssl_use_cabundle(); # bypass cURL's old CA bundle $auth->authenticate();

Establish a connection to the storage system

NOTE: Some versions of cURL include an outdated certificate authority (CA) file. This API ships with a newer version obtained directly from cURL's web site (http://curl.haxx.se). To use the newer CA bundle, call the CF_Connection instance's 'ssl_use_cabundle()' method.

$conn = new CF_Connection($auth); $conn->ssl_use_cabundle(); # bypass cURL's old CA bundle

Create a remote Container and storage Object

$images = $conn->create_container("photos"); $bday = $images->create_object("first_birthday.jpg");

Upload content from a local file by streaming it. Note that we use a "float" for the file size to overcome PHP's 32-bit integer limit for very large files.

$fname = "/home/user/photos/birthdays/birthday1.jpg"; # filename to upload $size = (float) sprintf("%u", filesize($fname)); $fp = open($fname, "r"); $bday->write($fp, $size);

Or... use a convenience function instead

$bday->load_from_filename("/home/user/photos/birthdays/birthday1.jpg");

»ùÇà ÄÚµå ÂüÁ¶¸¦ À§Çؼ­´Â samples µð·ºÅ丮¸¦ ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù.

Requres PHP 5.x (for Exceptions and OO syntax) and PHP's cURL module.

It uses the supporting "cloudfiles_http.php" module for HTTP(s) support and allows for connection re-use and streaming of content into/out of Cloud Files via PHP's cURL module.

See COPYING for license information. -cloudfiles-kt

Class for handling Cloud Files Authentication, call it's authenticate() method to obtain authorized service urls and an authentication token.

Example: Create the authentication instance

$auth = new CF_Authentication("ucloudbiz_Æ÷Å»_ID", "api_key");

$auth = new CF_Authentication("ucloudbiz_Æ÷Å»_ID", "api_key", NULL, AUTHURL); Using the AUTHURL keyword will force the api to use the 'https://api.ucloudbiz.olleh.com/storage/v1/auth'. ¸¸ÀÏ JPN ¼­ºñ½º¸¦ ÀÌ¿ëÇϰíÀÚ ÇÒ °æ¿ì, JPAUTHURL À» »ç¿ëÇÏ¸é µÈ´Ù.

NOTE: Some versions of cURL include an outdated certificate authority (CA) file. This API ships with a newer version obtained directly from cURL's web site (http://curl.haxx.se). To use the newer CA bundle, call the CF_Authentication instance's 'ssl_use_cabundle()' method.

$auth->ssl_use_cabundle(); # bypass cURL's old CA bundle

Perform authentication request

$auth->authenticate();

-cloudfiles-kt

Class for establishing connections to the Cloud Files storage system. Connection instances are used to communicate with the storage system at the account level; listing and deleting Containers and returning Container instances.

Example: Create the authentication instance

$auth = new CF_Authentication("username", "api_key");

Perform authentication request

$auth->authenticate();

Create a connection to the storage/cdn system(s) and pass in the validated CF_Authentication instance.

$conn = new CF_Connection($auth);

NOTE: Some versions of cURL include an outdated certificate authority (CA) file. This API ships with a newer version obtained directly from cURL's web site (http://curl.haxx.se). To use the newer CA bundle, call the CF_Authentication instance's 'ssl_use_cabundle()' method.

$conn->ssl_use_cabundle(); # bypass cURL's old CA bundle

-cloudfiles-kt

Container operations

Containers are storage compartments where you put your data (objects). A container is similar to a directory or folder on a conventional filesystem with the exception that they exist in a flat namespace, you can not create containers inside of containers.

You also have the option of marking a Container as "public" so that the Objects stored in the Container are publicly available via the CDN.

-cloudfiles-kt

Object operations

An Object is analogous to a file on a conventional filesystem. You can read data from, or write data to your Objects. You can also associate arbitrary metadata with them.

-cloudfiles-kt