通过 PHP 中的请求下载带有元数据的文件

$response = Requests::post("https://content.dropboxapi.com/2/files/download", array(
    'Authorization' => "Bearer <ACCESS_TOKEN>",
    'Dropbox-Api-Arg' => json_encode(array('path' => '/test.txt')),
));

$fileContent = $response->body;
$metadata = json_decode($response->headers['Dropbox-Api-Result'], true);

echo "File " . $metadata["name"] . " has the rev " . $metadata["rev"] . ".\n";

<ACCESS_TOKEN> 应替换为 OAuth 2 访问令牌。