cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

Problem calling API from PHP

New member | Level 2
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
Highlighted

Re: Problem calling API from PHP

Dropboxer
Dropboxer
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

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?