1

I've been developing a music website that plays .mp3 files from a Public dropbox folder, and I think I've found a solution on how to get file names from a directory in Dropbox.The code I've found is:

$consumerKey = 'key';
$consumerSecret = 'key';

require_once "dropbox-sdk/Dropbox/autoload.php";

session_start();
$oauth = new Dropbox_OAuth_PHP($consumerKey, $consumerSecret);

$dropbox = new Dropbox_API($oauth);

$info = $dropbox->getMetaData('Public', true);
print_r($info['contents']);

The autoload.php is in the right directory, all necessary files are present.But the error I get is:

Fatal error: Class 'Dropbox_OAuth_PHP' not found in C:\wamp\www\api\index.php on line 10

Is there something I'm doing wrong?

8
  • Is it successfully loading the autoload.php?
    – Albzi
    Commented Feb 16, 2015 at 12:01
  • Well it's showing on directory index... so I guess.And it would probably show some other error too.
    – Erlandas
    Commented Feb 16, 2015 at 12:04
  • The current documentation for the SDK doesn't reflect this code at all: dropbox.com/developers/core/start/php - perhaps what ever code you copied is old? The current SDK isn't used this way at all.
    – Dan Smith
    Commented Feb 16, 2015 at 12:06
  • That well might be it.I'll check on that.
    – Erlandas
    Commented Feb 16, 2015 at 12:08
  • there's nothing wrong with the require_once part, if the file was missing it would crash and the script execution would stop and you wouldn't be seeing the fatal error on line $oauth = new Dropbox_OAuth_PHP($consumerKey, $consumerSecret);.
    – rasso
    Commented Feb 16, 2015 at 12:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.