I have a file that is in the form of a word doc on my dropbox application. I was able to get a working php curl without any errors from dropbox's side to download the file. I understand through the http docs that it is the file content that you are reading from the api. However, in my application, the curl is executed and there is no pop up from my browser to download the file. If I am using dropbox to download, how would I use the api request's content correctly for my app such that I could download the file content into a file on my machine which was the intended feature. Thus far, this what I have come up with from my code:
$timeout = 50;
$url = "https://content.dropboxapi.com/2/sharing/get_shared_link_file";
$sql = $con -> query("SELECT * FROM intern WHERE InternName = '$pointer'");
$resume = $sql -> fetch(PDO::FETCH_ASSOC);
$filename = str_replace('%', '_', explode('?', basename($resume['Resume']))[0]);
$fp = fopen($filename , "w+");
$rcurl = curl_init();
$params = array(
utf8_encode("Authorization: Bearer " . $resume['DropboxToken']),
"Dropbox-API-Arg: " . json_encode(array(
"url" => $resume['Resume']
)));
curl_setopt($rcurl, CURLOPT_URL, $url);
curl_setopt($rcurl, CURLOPT_HTTPHEADER, $params);
curl_setopt($rcurl, CURLOPT_FILE, $fp);
curl_setopt($rcurl, CURLOPT_TIMEOUT, $timeout);
curl_setopt($rcurl, CURLOPT_POST, false);
curl_setopt($rcurl, CURLOPT_RETURNTRANSFER, true);
$download = curl_exec($rcurl);
$http_request = curl_getinfo($rcurl, CURLINFO_HTTP_CODE);
echo $download;
echo $http_request;