Beispiel #1
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('LOCAL_PATH', '/path/to/local/image/file');
# add path to local (image) file, to be uploaded to the CDN
require_once 'raws_json/rats_service.php';
try {
    $rats = new RatsService(USER, PWD);
    # upload overlay file
    $overlay = $rats->createOverlay("test_rats_api_overlay", LOCAL_PATH);
    echo "\nUploaded overlay: " . $overlay->entry->id;
    echo "\nOverlay has filename = " . $overlay->entry->content->params->filename . " and position = " . $overlay->entry->content->params->position;
    # update overlay position
    $overlay->entry->content->params->position = "10:10";
    $overlay = $rats->updateOverlay($overlay);
    echo "\nSet new overlay position: " . $overlay->entry->content->params->position;
    # retrieve a single overlay instance based on the ID
    $overlay = $rats->getOverlayInstance($overlay->entry->content->params->id);
    echo "\nRetrieved overlay with filename = " . $overlay->entry->content->params->filename . " and position = " . $overlay->entry->content->params->position;
    echo "\nGetting overlay list:";
    $overlay_list = $rats->getOverlayList();
    foreach ($overlay_list->feed->entry as $o) {
        echo "\n Overlay has filename = " . $o->content->params->filename . " and position = " . $o->content->params->position;
    }
} catch (Exception $e) {
    echo "\nAn exception occurred with code = " . $e->getCode();
    echo "\nError msg = " . $e->getMessage();
}