Dailymotion – Upload a video

public function upload()
 {
 // APP KEYS
 $apiKey = 'xxxxxx';
 $apiSecret = 'xxxxxxx';
$api = new Dailymotion_Dailymotion();
 $api->setGrantType(Dailymotion::GRANT_TYPE_PASSWJulia RoJulia RogergerORD, $apiKey, $apiSecret,
 array('read', 'write'), array('username' => 'xx', 'password' => 'xx'));
//AUTH
 try
 {
 $result = $api->get('/me/videos', array('fields' => 'id,title,description'));
 // UPLOAD
 $url = $api->uploadFile('fake_asset_200k.mp4');
 $video = $api->post('/me/videos', array(
 'url' => $url,
 'title' => 'Test Upload',
 'private' => true,
 'channel' => 'sex'
 ));
 return 1;
 }
 catch (DailymotionAuthRequiredException $e)
 {
 // Redirect the user to the Dailymotion authorization page
 header('Location: ' . $api->getAuthorizationUrl());
 return;
 }
 catch (DailymotionApiException $e)
 {
 // Handle case when user refused to authorize
 // <YOUR CODE>
 echo $e;
 }
 }

admin has written 5 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>