# limitations under the License.
require_once 'raws_json/rass_service.php';
# Provide the path to a local testfile, that can be uploaded via RASS
define('LOCAL_FILE', '/path/to/local/file');
# add path to local (video) file, to be uploaded to the CDN
# Provide your own RASS credentials here
define('USER', 'xxx');
# your user account name
define('PWD', 'xxx');
# your user account pwd
define('RASS_SERVER', 'rass.cdn0x.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
# all RASS API methods (except HEAD) will raise an exception if they don't return an HTTP SUCCESS CODE (200,201,204)
try {
    # Instantiate an object that manages the RASS connection, passing it your login credentials and the base service uri
    $rass = new RassService(USER, PWD, RASS_SERVER);
    # Creates a "tutorial2" directory below your root dir
    $dir = $rass->createDir("tutorial2");
    # Retrieve the entry's "path" param
    echo "Created directory with path: " . $dir->entry->content->params->path . "\n";
    # Note: the URL for accessing this new dir resource is available as the entry's id
    echo "New dir resource can be accessed at the URL: " . $dir->entry->id . "\n";
    # Uploads the local file as 'taste.mp4' to the "tutorial2" directory on the CDN
    $item = $rass->createItem($dir->entry->content->params->path, "taste.mp4", LOCAL_FILE);
    # Retrieve the entry's "path" attribute
    echo "\nCreated file with path: " . $item->entry->content->params->path . "\n";
    # Retrieve the filename on the CDN
    echo "Filename: " . $item->entry->content->params->filename . "\n";
    # Get the location of the file on the CDN from the entry's 'enclosure' link
    echo "Public download location of the uploaded file: " . $rass->getEnclosureLink($item) . "\n";
    # Note: the URL for accessing this new item resource is available as the entry's id
Esempio n. 2
0
# limitations under the License.
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
define('LOCAL_PATH', '/path/to/local/file.mp4');
# add path to local (video) file, to be uploaded to the CDN
require_once 'raws_json/meta.php';
require_once 'raws_json/json_client.php';
require_once 'raws_json/meta_service.php';
require_once 'raws_json/rass_service.php';
try {
    $rass = new RassService(USER, PWD, RASS_SERVER);
    $meta = new MetaService(USER, PWD);
    # upload file to CDN (RASS PUT item)
    $item1 = $rass->createItem("/test/content/", "myfile_one.mp4", LOCAL_PATH, True);
    $item2 = $rass->createItem("/test/content/", "myfile_two.mp4", LOCAL_PATH, True);
    # create content instance for item1
    $f = array();
    $f[] = new FileObj($item1->entry->content->params->path);
    $m = array();
    $m[] = new MetaObj("Title", "rss", "My first file", "en");
    $m[] = new MetaObj("Description", "rss", "Description of my first file", "en");
    $content_obj1 = new MetaContent("myfile_one", $f, null, $m);
    $content = $meta->createContent($content_obj1->to_entry());
    $content_obj1->from_entry($content);
    echo "\nCreated new content instance with name = " . $content_obj1->name . "\n";
    # create content instance for item2
# limitations under the License.
require_once 'raws_json/rass_service.php';
# Provide the path to a local testfile, that can be uploaded via RASS
define('LOCAL_FILE', '/path/to/local/file');
# add path to local (video) file, to be uploaded to the CDN
# Provide your own RASS credentials here
define('USER', 'xxx');
# your user account name
define('PWD', 'xxx');
# your user account pwd
define('RASS_SERVER', 'rass.cdn0x.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
# all RASS API methods (except HEAD) will raise an exception if they don't return an HTTP SUCCESS CODE (200,201,204)
try {
    # Instantiate an object that manages the RASS connection, passing it your login credentials and the base service uri
    $rass = new RassService(USER, PWD, RASS_SERVER);
    ## TUTORIAL PRE-CONFIG: FIRST CREATE DIRECTORY + UPLOAD FILES TO HAVE SOME TEST-DATA
    # Create a "tutorial6" directory under the root-directory
    $item = null;
    $dir = $rass->createDir("tutorial6", True);
    echo "Created directory with path: " . $dir->entry->content->params->path . "\n";
    $ctr = 1;
    # Upload the local file 15 times as 'testXX.mp4' to the "tutorial6" directory (creating some test data)
    while ($ctr < 16) {
        $item = $rass->createItem($dir->entry->content->params->path, "test{$ctr}.mp4", LOCAL_FILE);
        echo "Created file with path: " . $item->entry->content->params->path . "\n";
        $ctr += 1;
    }
    ## GETTING LINK ELEMENTS FOR AN ENTRY
    # Directly getting at an item entry's link elements
    echo "\nGetting all link elements for entry with path: " . $item->entry->content->params->path . "\n";
Esempio n. 4
0
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
define('LOCAL_PATH', '/path/to/local/file.mp4');
# add path to local (video) file, to be uploaded to the CDN
require_once 'raws_json/meta.php';
require_once 'raws_json/json_client.php';
require_once 'raws_json/meta_service.php';
require_once 'raws_json/rass_service.php';
try {
    $meta = new MetaService(USER, PWD);
    $rass = new RassService(USER, PWD, RASS_SERVER);
    # upload files to CDN (RASS PUT item)
    $item1 = $rass->createItem("/test/content/", "big_buck_bunny.mp4", LOCAL_PATH, True);
    $item1b = $rass->createItem("/test/content/", "big_buck_bunny.jpg", LOCAL_PATH, True);
    $item2 = $rass->createItem("/test/content/", "sintel.mp4", LOCAL_PATH, True);
    # create vocabs
    if (!$meta->vocabExists("media")) {
        $meta->createVocab("media", "http://search.yahoo.com/mrss/");
    }
    if (!$meta->vocabExists("myvocab")) {
        $meta->createVocab("myvocab", "http://myvocab.org/ns/");
    }
    # Create content instance with multiple languages for "/test/content/big_buck_bunny.mp4"
    $content_obj1 = new MetaContent("big_buck_bunny");
    $content_obj1->add_file_obj($item1->entry->content->params->path);
    $content_obj1->add_file_obj($item1b->entry->content->params->path);
Esempio n. 5
0
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
define('LOCAL_PATH', '/path/to/local/file.mp4');
# add path to local (video) file, to be uploaded to the CDN
require_once 'raws_json/meta.php';
require_once 'raws_json/json_client.php';
require_once 'raws_json/meta_service.php';
require_once 'raws_json/rass_service.php';
try {
    $meta = new MetaService(USER, PWD);
    $rass = new RassService(USER, PWD, RASS_SERVER);
    # upload file to CDN (RASS PUT item)
    $item = $rass->createItem("/test/content/", "big_buck_bunny.mp4", LOCAL_PATH, True);
    # create content instance without metadata
    $content_obj = new MetaContent("big_buck_bunny");
    $content_obj->add_file_obj($item->entry->content->params->path);
    $content = $meta->createContent($content_obj->to_entry());
    echo "\nCreated new content instance with name = " . $content->entry->content->params->name . "\n";
    # add tags to the content instance
    $content_obj->from_entry($content);
    $content_obj->set_tags(array("bunny", "animation", "Blender"));
    $content = $meta->updateContent($content_obj->to_entry());
    echo "\nAdded tags to content instance with name = " . $content_obj->name . "\n";
    # get content instance
    $content = $meta->getContentInstance($content_obj->name);
    $content_obj->from_entry($content);
# limitations under the License.
require_once 'raws_json/json_client.php';
require_once 'raws_json/rass_service.php';
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
$local_path = "/path/to/local/file";
# path to the file that will be published
$filename = "myfilename.mp4";
# name to be given to the file on the CDN
$publish_dir = "mydir";
# directory on the CDN in which to publish the file (leave empty to publish in root-directory)
$secret = "xxx";
# the secret from the RASS user settings, should not be made public !!
$seconds_valid = 30;
# the number of seconds this request will remain valid
try {
    # no pwd needed, since rass->doFileUpload() sends a HMAC based on the $secret
    $rass = new RassService(USER, null, RASS_SERVER);
    # RASS PUT file_upload
    echo "\nUploading file to CDN, please wait..";
    $res = $rass->doFileUpload($filename, $local_path, $secret, $seconds_valid, $publish_dir);
    foreach ($resp->href as $href) {
        echo "\nFile published on CDN: " . $href;
    }
} catch (Exception $e) {
    echo "\nAn exception occurred with code = " . $e->getCode();
    echo "\nError msg = " . $e->getMessage();
}
# limitations under the License.
require_once 'raws_json/rass_service.php';
# Provide the path to a local testfile, that can be uploaded via RASS
define('LOCAL_FILE', '/path/to/local/file');
# add path to local (video) file, to be uploaded to the CDN
# Provide your own RASS credentials here
define('USER', 'xxx');
# your user account name
define('PWD', 'xxx');
# your user account pwd
define('RASS_SERVER', 'rass.cdn0x.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
# all RASS API methods (except HEAD) will raise an exception if they don't return an HTTP SUCCESS CODE (200,201,204)
try {
    # Instantiate an object that manages the RASS connection, passing it your login credentials and the base service uri
    $rass = new RassService(USER, PWD, RASS_SERVER);
    # Upload the local file as 'testX.mp4' to the CDN (= account's root-directory)
    $items = array();
    $ctr = 1;
    while ($ctr < 3) {
        $items[] = $item = $rass->createItem("/", "test{$ctr}.mp4", LOCAL_FILE);
        echo "Created file with path: " . $item->entry->content->params->path . "\n";
        $ctr += 1;
    }
    # Create a "bucks" directory under the root-directory
    $dir = $rass->createDir("bucks", True);
    echo "Created directory with path: " . $dir->entry->content->params->path . "\n";
    $ctr = 1;
    # Upload the local file as 'bunnyX.mp4' to the "bucks" directory
    while ($ctr < 3) {
        $item = $rass->createItem($dir->entry->content->params->path, "bunny{$ctr}.mp4", LOCAL_FILE);
Esempio n. 8
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx;;");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
require_once 'raws_json/json_client.php';
require_once 'raws_json/rass_service.php';
try {
    $rass = new RassService(USER, PWD, RASS_SERVER);
    # create dir on CDN
    $dir = $rass->createDir("/test/sample/dir", True);
    echo "\nCreated dir: " . $dir->entry->id . "\n";
    # retrieve feed of dirs
    echo "\nGetting dir list...";
    $feed = $rass->getDirList("/test/");
    foreach ($feed->feed->entry as $e) {
        echo "\n* retrieved dir: " . $e->id . " with size = " . $e->content->params->size;
    }
    echo "\n... finished retrieving dir instances.\n";
    # delete file from cdn
    $rass->deleteDir($dir->entry->content->params->path);
    echo "\nDeleted dir with path = " . $dir->entry->content->params->path . "\n";
} catch (Exception $e) {
    echo "\nAn exception occurred with code = " . $e->getCode();
Esempio n. 9
0
# limitations under the License.
# To run this sample, define these variables first
define('USER', "xxx");
# name of your Rambla user account
define('PWD', "xxx");
# password of your Rambla user account
define('RASS_SERVER', 'rass.cdnXX.rambla.be');
# either 'rass.cdn01.rambla.be' or 'rass.cdn02.rambla.be' (depending on the subCDN on which your account is located)
define('LOCAL_PATH', '/path/to/local/file.mp4');
# add path to local (video) file, to be uploaded to the CDN
require_once 'raws_json/meta.php';
require_once 'raws_json/json_client.php';
require_once 'raws_json/meta_service.php';
require_once 'raws_json/rass_service.php';
try {
    $rass = new RassService(USER, PWD, RASS_SERVER);
    $meta = new MetaService(USER, PWD);
    # upload file to CDN (RASS PUT item)
    $item1 = $rass->createItem("/test/content/", "myfile_with_meta.mp4", LOCAL_PATH, True);
    $item2 = $rass->createItem("/test/content/", "myfile_no_meta.mp4", LOCAL_PATH, True);
    # create content instance
    $f = array();
    $f[] = new FileObj($path = $item1->entry->content->params->path, $media_type = "video");
    $content = new MetaContent($name = "myfile_with_meta", $file_objs = $f);
    $content->tags = array("een", "twee", "drie");
    $content_obj = $meta->createContent($content->to_entry());
    $content->from_entry($content_obj);
    echo "\nCreated new content instance with name = " . $content->name . "\n";
    # get contentdir feed
    echo "\n\nGetting contentdir list...";
    $feed = $meta->getContentdirList("/");