我正在使用Dailymotion ( http://www.dailymotion.com/doc/api/sdk-php.html )在我的每日运动帐户上上传视频。
我可以上传一个视频使用这个脚本,但如果我试图上传另一个视频在几分钟后,我做不到。它打印此错误:
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);
}
?>
发布于 2014-07-02 07:45:30
您自己对问题的堆栈跟踪显示了其失败的原因:
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
您在调用Dailymotion->uploadFile('')
时,在index.php文件中没有任何文件名,在第39行,这是无法工作的。消息来自SDK正在使用的cURL库。你的请求从来没有离开过你的剧本。
https://stackoverflow.com/questions/24513562
复制相似问题