0
votes

I am using Dailymotion SDK PHP ( http://www.dailymotion.com/doc/api/sdk-php.html ) to upload video on my Dailymotion Account.

I can upload 1 video using this script, but if I try to upload another video after few minutes I can't do. It prints this error:

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

Here the PHP code:

<?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);
}
?>
1
You should post your code.Sal00m
I have added the code. :)acchiappasogni

1 Answers

2
votes

Your own stack trace of the problem shows you why its failing:

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

You're calling Dailymotion->uploadFile('') without any file name in your index.php file, at line 39, that can't work. The message comes from the cURL library that the SDK is using. Your request never even leaves your script.