cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

John D.24
New member | Level 1

I've been using the PHP SDK to save files programmatically for well over a year without issue.  However, just in the past few days a problem suddenly appeared that is throwing a fatal error.  I have updated the SDK with the current dropbox-sdk-php-1.1.6 files, with no change.

The error occurs as I make a call to 

$dbxClient->createShareableLink($objFile->fileFolder);

 

PHP Fatal error: Uncaught exception 'Dropbox\Exception_BadResponseCode' with message 'Unexpected HTTP status 301

' in /~application~/includes/dropbox-sdk/Dropbox/RequestUtil.php:256
Stack trace:
#0 /~application~/includes/dropbox-sdk/Dropbox/Client.php(1034): Dropbox\RequestUtil::unexpectedStatus(Object(Dropbox\HttpResponse))
#1 /~application~/uploadFile.php(124): Dropbox\Client->createShareableLink('//WGASC/Alvarad...')
#2 {main}
thrown in /~application~/includes/dropbox-sdk/Dropbox/RequestUtil.php on line 256

Again - this has been working just fine for months until the last few days (<1 week).

Anyone have an idea of what's going on ... and how to resolve?

Thank you in-advance.

-john

 

 

 

 

6 Replies 6

Re: PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

Steve M.
Dropboxer

You mentioned uploadFileFromString, but it looks like the error is coming from createShareableLink?

Also, I notice that the path you're passing to createShareableLink has an extra leading slash. My guess is that this is the culprit... try getting rid of that leading slash to see if the problem goes away.

Re: PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

John D.24
New member | Level 1

NOTE: I removed the additional '/' from the beginning of the folder name and the problem was resolved.   What is strange is that the double '/' has been working for months.

 

Re: PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

Steve M.
Dropboxer

My guess is that something changed on the Dropbox side to redirect paths with double slashes in them. (E.g. /foo//bar gets redirect to /foo/bar.) I'll make sure the right folks take a look at this.

Re: PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

Pankaj G.
New member | Level 1

This created a huge problem with our integration and we were scratching our head what is wrong. Finally landed here and now know the issue. Is there a way for drop box to inform the community when something of this sort changes? Lot of time gets wasted otherwise

Re: PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

Greg-DB
Dropboxer

Apologies for the inconvenience Pankaj! We of course never want to break apps, and we email and post on the blog whenever we are planning a breaking change or deprecation. This change in validation wasn't intended to be a breaking change though, so there wasn't any outreach. 

Re: PHP SDK 'Unexpected HTTP status 301' returned from Dropbox/RequestUtil.php:256

Greg-DB
Dropboxer

For reference, we've now reverted the behavior change, so the double slash version should work again. We do recommend only using a single slash though.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    Pankaj G. New member | Level 1
  • User avatar
    Steve M. Dropboxer
  • User avatar
    John D.24 New member | Level 1
What do Dropbox user levels mean?
Need more support?