Skip to content

Instantly share code, notes, and snippets.

@phpfunk
Created May 30, 2012 19:56
Show Gist options
  • Save phpfunk/2838575 to your computer and use it in GitHub Desktop.
Save phpfunk/2838575 to your computer and use it in GitHub Desktop.
Post Roll Permalink - Viddler API
<?
include '/path/to/viddler/api/';
$v = new Viddler_V2('YOUR API KEY');
$auth = $v->viddler_users_auth(array(
'user' => 'YOUR USERNAME',
'password' => 'YOUR PASSWORD'
));
if (! isset($auth['auth']['sessionid'])) {
//Handle auth error
}
//Open in current window
$embed = $v->viddler_videos_getEmbedCode(array(
'sessionid' => $auth['auth']['sessionid'],
'video_id' => 'VIDEO_ID',
'embed_code_type' => 5,
'videobrowserfollowpermalink' => '1',
'videobrowserfollowpermalinktarget' => 'current'
));
//Open in new window
$embed = $v->viddler_videos_getEmbedCode(array(
'sessionid' => $auth['auth']['sessionid'],
'video_id' => 'VIDEO_ID',
'embed_code_type' => 5,
'videobrowserfollowpermalink' => '1',
'videobrowserfollowpermalinktarget' => 'new'
));
echo (isset($embed['video']['embed_code'])) ? $embed['video']['embed_code'] : 'No embed code found';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment