Skip to content

Instantly share code, notes, and snippets.

@icanhazdevops
Last active December 19, 2015 22:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icanhazdevops/6029442 to your computer and use it in GitHub Desktop.
Save icanhazdevops/6029442 to your computer and use it in GitHub Desktop.
temp url
// connect to Cloud Files
$objstore = $connection->ObjectStore('cloudFiles', 'DFW');
// Set a secret
define('TEMP_URL_SECRET', 'This is my secret');
$objstore->SetTempUrlSecret(TEMP_URL_SECRET);
// Put the container and file names
$mycontainer = $objstore->Container('CdnContainer');
$object = $mycontainer->DataObject('FOOBAR');
// Create the temp url
$tempurl = $object->TempUrl(TEMP_URL_SECRET, 20, 'GET');
// Print stuff for testing
printf("Filename: %s\n", $object->Name());
printf("CDN URL: %s\n", $object->PublicURL());
printf("TEMP URL: %s\n", $tempurl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment