【发布时间】:2014-07-02 15:45:30
【问题描述】:
我正在使用 Dailymotion SDK PHP (http://www.dailymotion.com/doc/api/sdk-php.html) 将视频上传到我的 Dailymotion 帐户。
我可以使用此脚本上传 1 个视频,但如果我在几分钟后尝试上传另一个视频,我将无法做到。它打印此错误:
Fatal error: Uncaught exception 'DailymotionTransportException' with
message 'couldn't open file "" ' in Dailymotion.php:686 Stack trace: #0
Dailymotion.php(213): Dailymotion->httpRequest('http://upload-0...', Array)
#1 index.php(39): Dailymotion->uploadFile('') #2 {main} thrown in Dailymotion.php
on line 686
这里是 PHP 代码:
<?php
session_start();
// ----- account settings -----//
$apiKey = 'XXXXX';
$apiSecret = 'XXXXX';
$testUser = 'XXXXX';
$testPassword = 'XXXXX';
$videoTestFile = 'test.mov';
require_once 'Dailymotion.php';
//----- scopes you need to run your tests -----//
$scopes = array('userinfo',
'feed',
'manage_videos');
//----- Dailymotion object instanciation -----//
$api = new Dailymotion();
$api->setGrantType(
Dailymotion::GRANT_TYPE_PASSWORD,
$apiKey,
$apiSecret,
array(implode(',', $scopes)),
array(
'username' => $testUser,
'password' => $testPassword
)
);
$url = $api->uploadFile($videoTestFile);
$result = $api->post(
'/videos',
array('url' => $url,
'title' => 'Test',
'published' => true,
'channel' => 'sport',
'private' => 'true',
)
);
var_dump($result);
}
?>
【问题讨论】:
-
你应该发布你的代码。
-
我已经添加了代码。 :)
标签: php video-processing dailymotion-api