$access_token = $dropbox->GetAccessToken($request_token); store_token($access_token, "access"); delete_token($_GET['oauth_token']); } // checks if access token is required if (!$dropbox->IsAuthorized()) { // redirect user to dropbox auth page $return_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . "?auth_callback=1"; $auth_url = $dropbox->BuildAuthorizeUrl($return_url); $request_token = $dropbox->GetRequestToken(); store_token($request_token, $request_token['t']); die("Authentication required. <a href='{$auth_url}'>Click here.</a>"); } echo "<pre>"; echo "<b>Account:</b>\r\n"; print_r($dropbox->GetAccountInfo()); $files = $dropbox->GetFiles("", false); if (empty($files)) { $dropbox->UploadFile("leonidas.jpg"); $files = $dropbox->GetFiles("", false); } echo "\r\n\r\n<b>Files:</b>\r\n"; print_r(array_keys($files)); if (!empty($files)) { $file = reset($files); $test_file = "test_download_" . basename($file->path); echo "<img src='" . $dropbox->GetLink($file, false) . "'/></br>"; echo "\r\n\r\n<b>Meta data of <a href='" . $dropbox->GetLink($file) . "'>{$file->path}</a>:</b>\r\n"; print_r($dropbox->GetMetadata($file->path)); echo "{$test_file}</br>"; echo "\r\n\r\n<b>Downloading {$file->path}:</b>\r\n";