} // Check for CURL if (!extension_loaded('curl') && !@dl(PHP_SHLIB_SUFFIX == 'so' ? 'curl.so' : 'php_curl.dll')) { exit("\nERROR: CURL extension not loaded\n\n"); } // Pointless without your keys! if (AccessKey == 'change-this' || SecretKey == 'change-this') { exit("\nERROR: access information required\n\nPlease edit the following lines in this file:\n\n" . "define('AccessKey', 'change-me');\ndefine('SecretKey', 'change-me');\n\n"); } // Instantiate the class $scs = new SCS(AccessKey, SecretKey); echo "SCS::getAuthenticatedURL(): " . SCS::getAuthenticatedURL('sdk', 'snapshot/snapshot.png', 86400000) . "\n"; // List your buckets: echo "SCS::listBuckets(): " . print_r($scs->listBuckets(), 1) . "\n"; // Create a bucket with public read access if ($scs->putBucket($bucketName, SCS::ACL_PUBLIC_READ)) { echo "Created bucket {$bucketName}" . PHP_EOL; // Put our file (also with public read access) if ($scs->putObjectFile($uploadFile, $bucketName, baseName($uploadFile), SCS::ACL_PUBLIC_READ)) { echo "SCS::putObjectFile(): File copied to {$bucketName}/" . baseName($uploadFile) . PHP_EOL; // Get the contents of our bucket $contents = $scs->getBucket($bucketName); echo "SCS::getBucket(): Files in bucket {$bucketName}: " . print_r($contents, 1); // Get object info $info = $scs->getObjectInfo($bucketName, baseName($uploadFile)); echo "SCS::getObjectInfo(): Info for {$bucketName}/" . baseName($uploadFile) . ': ' . print_r($info, 1); // You can also fetch the object into memory // var_dump("SCS::getObject() to memory", $scs->getObject($bucketName, baseName($uploadFile))); // Or save it into a file (write stream) // var_dump("SCS::getObject() to savefile.txt", $scs->getObject($bucketName, baseName($uploadFile), 'savefile.txt')); // Or write it to a resource (write stream)