true, CURLOPT_USERPWD => $DROPBOX_APP_KEY . ':' . $DROPBOX_APP_SECRET, CURLOPT_POSTFIELDS => http_build_query([ "grant_type" => "refresh_token", "refresh_token" => $DROPBOX_REFRESH_TOKEN ]), ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); curl_close($ch); // === HANDLE ERRORS === if ($error) { echo json_encode([ "error" => "cURL error: " . $error ]); exit; } if ($httpCode !== 200) { echo json_encode([ "error" => "Dropbox API returned HTTP $httpCode", "response" => $response ]); exit; } // === SUCCESS === echo $response; exit; ?>