PHP code example of bluebillywig / vmsrpc

1. Go to this page and download the library: Download bluebillywig/vmsrpc library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bluebillywig / vmsrpc example snippets




use BlueBillywig\VMSRPC\RPC;

$host = 'https://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password';

try {
    $vms = new RPC($host, $user, $password);
} catch (\Exception $e) {
    echo $e->getMessage();
}



use BlueBillywig\VMSRPC\RPC;

$host = 'https://YourPublication.bbvms.com';
$sharedSecret = '123-1234567890abcdefghijklmnopqrstuv';

try {
    $vms = new RPC($host, null, null, $sharedSecret);
} catch (\Exception $e) {
    echo $e->getMessage();
}



use BlueBillywig\VMSRPC\RPC;

$host = 'https://YourPublication.bbvms.com';
$sharedSecret = '123-1234567890abcdefghijklmnopqrstuv';
$arProps = array(
    'query' => 'type:mediaclip AND status:published',
    'limit' => '10',
    'sort' =>'createddate desc'
);

try {
    $vms = new RPC($host, null, null, $sharedSecret);

    $search_result = json_decode($vms->json('search', null, $arProps));

    if($search_result->count > 0) {
        foreach($search_result->items as $oMc) {            
            echo '<script type="text/javascript" src="' . $host . '/p/default/c/'.$oMc->id.'.js"></script>';
        }
    }
} catch (\Exception $e) {
    echo $e->getMessage();
}



use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    //Set the status to draft
    $arProps = array(
        'xml' => '<media-clip id="1234567" status="draft"></media-clip>'
    );
    $r = $vms->doAction('mediaclip', 'put', $arProps);
} catch (\Exception $e) {
    echo $e->getMessage();
}



use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    //Add a new mediaclip, add a file, set the title and set the status.
    $file = getcwd() . "/someVideo.mp4";
    $arProps = array(
        'xml' => '<media-clip title="New mediaclip"  status="draft"></media-clip>', 
        'Filedata' => '@'.$file
    );

    $r = $vms->doAction('mediaclip', 'put', $arProps);
} catch (\Exception $e) {
    echo $e->getMessage();
}



use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    $arProps = array(
        'query' => 'type:mediaclip','limit' => '10',
        'sort' =>'createddate desc'
    );
    $r = json_decode($vms->json('search', null, $arProps));
} catch (\Exception $e) {
    echo $e->getMessage();
}



use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    $r = $vms->xml('publication');
} catch (\Exception $e) {
    echo $e->getMessage();
}



use BlueBillywig\VMSRPC\RPC;

$host = 'http://YourPublication.bbvms.com';
$user = 'UserName';
$password = 'Password'; 

try {
    $vms = new RPC($host, $user, $password);

    $apiEntityUrl = "";
    $qs = 'mainconfig.xml';

    $r = $vms->uri($apiEntityUrl, $qs);
} catch (\Exception $e) {
    echo $e->getMessage();
}