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 ;
}