Dropbox API 在PHP和cURL扩展中通过curl列出根文件夹
示例
<?php $parameters = array('path' => '','include_deleted' => true,'recursive' => true); $headers = array('Authorization: Bearer <ACCESS_TOKEN>', 'Content-Type: application/json'); $curlOptions = array( CURLOPT_HTTPHEADER => $headers, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($parameters), CURLOPT_RETURNTRANSFER => true, CURLOPT_VERBOSE => true ); $ch = curl_init('https://api.dropboxapi.com/2/files/list_folder'); curl_setopt_array($ch, $curlOptions); $response = curl_exec($ch); echo $response; curl_close($ch); ?>
请注意,响应中可能包含has_more=true,在这种情况下,您的应用应回叫到/files/list_folder/continue继续获取更多条目。
<ACCESS_TOKEN>应该用OAuth2访问令牌替换。