cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem calling API from PHP

Problem calling API from PHP

hossein
New member | Level 2

I make the authentication step and got the accesstoken as well.

now I want to start an API call so I wrote the below code:


# Include the Dropbox SDK libraries
require_once "dropbox-sdk/Dropbox/autoload.php";
use \Dropbox as dbx;
$accessToken="XXXXXXXXXXXXXXXXXXXXXXX";
echo "Step 1 <br>";
$dbxClient = new dbx\Client($accessToken, "updashboard-test");
echo "Step 2 <br>".var_dump($dbxClient);
$accountInfo = $dbxClient->getAccountInfo();
echo "Step 3 <br>";
var_dump($accountInfo);

 

it passed Step 1 and 2 but stoped on step 3 and notting desplayed. plese see the below my screen shot:

 

Step 1 
object(Dropbox\Client)#2 (6) { ["accessToken":"Dropbox\Client":private]=> string(64) "XXXXX" ["clientIdentifier":"Dropbox\Client":private]=> string(16) "updashboard-test" ["userLocale":"Dropbox\Client":private]=> NULL ["apiHost":"Dropbox\Client":private]=> string(15) "api.dropbox.com" ["contentHost":"Dropbox\Client":private]=> string(23) "api-content.dropbox.com" ["host"]=> object(Dropbox\Host)#3 (3) { ["api":"Dropbox\Host":private]=> string(15) "api.dropbox.com" ["content":"Dropbox\Host":private]=> string(23) "api-content.dropbox.com" ["web":"Dropbox\Host":private]=> string(15) "www.dropbox.com" } }

Step 2 

 

I canged AccessToken to XXXX on the above codes.

please let me know why it is like this.

1 Reply 1

Greg-DB
Dropbox Staff
The Dropbox PHP you're using here uses API v1, which is retired, so it will no longer work:

https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/

You'll need to migrate to API v2. We don't have an official PHP SDK for Dropbox API v2, but you can use a third party library:

https://www.dropbox.com/developers/documentation/communitysdks

Or, you can call the HTTPS endpoints themselves:

https://www.dropbox.com/developers/documentation/http/documentation
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?