Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
using cURL in PHP to call the /files/download api. Dropbox returns "Error (4xx) We can't find the page you're looking for." How to troubleshoot? I think I am using the API correctly.
function getTextFile( $token ) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://content.dropboxapi.com/2/files/download"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0 ) ; $headers = array(); $headers[] = "Authorization: Bearer " . $token ; $headers[] = "Dropbox-Api-Arg: {\"path\": \"/test_upload.txt\"}"; $headers[] = 'Content-Type: text/plain; charset=utf-8' ; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close ($ch); return $result ; }
Thanks for the help Greg.
I run this code on a PHP hosting site and it works. Run it on our production ZEND PHP server and it fails. So I do not know what to do. For now I am going to have the hosting site get the files from dropbox. Then use cURL to send the data from the hosting site to the production server.
I ran the code with CURLOPT_HEADERFUNCTION. Got this back:
this PHP code works on a server running PHP 7.0.27. It is failing on PHP 5.6.15.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!