0
我試圖通過PHP位DailyMotion SDK發送視頻使用此代碼:位DailyMotion無效授權碼
<?php
require_once 'dailymotion-sdk-php-master/Dailymotion.php';
$api = new Dailymotion();
$api->setGrantType(Dailymotion::GRANT_TYPE_AUTHORIZATION, '081cf3f9d3f64c8d9234', '98da6430d6ebef2621f1061886ecde1a0aa57def', array('manage_videos'));
try
{
$url = $api->uploadFile('video.avi');
$result = $api->call('video.create', array('url' => $url));
}
catch (DailymotionAuthRequiredException $e)
{
// Redirect the user to the Dailymotion authorization page
header('Location: ' . $api->getAuthorizationUrl());
return;
}
catch (DailymotionAuthRefusedException $e)
{
// Handle case when user refused to authorize
// <YOUR CODE>
}
?>
我總是得到以下錯誤:
Fatal error: Uncaught exception 'DailymotionAuthException' with message 'Invalid authorization code.' in /folder/public_html/dailymotion-sdk-php-master/Dailymotion.php:541 Stack trace:
#0 /folder/public_html/dailymotion-sdk-php-master/Dailymotion.php(370): Dailymotion->oauthTokenRequest(Array)
#1 /folder/public_html/dailymotion-sdk-php-master/Dailymotion.php(247): Dailymotion->getAccessToken()
#2 /folder/public_html/dailymotion-sdk-php-master/Dailymotion.php(203): Dailymotion->call('GET /file/uploa...', Array)
#3 /folder/public_html/dailymotion-sdk-php-master/Dailymotion.php(189): Dailymotion->get('/file/upload')
#4 /folder/public_html/index.php(9): Dailymotion->uploadFile('video.avi')
#5 {main} thrown in /folder/public_html/dailymotion-sdk-php-master/Dailymotion.php on line 541
我已經試過JLepage建議(https://stackoverflow.com/questions/12330141/dailymotion-api-invalid-authorization-code),但沒有成功。 任何人都可以幫助我嗎?