Retrieve contents of a public Dropbox folder?

☆樱花仙子☆ 提交于 2019-12-20 12:43:04

问题


Is there a way to retrieve a list of the contents of a public Dropbox folder (preferably in PHP)? This is what a URL to a public file in Dropbox looks like:

http://dl.dropbox.com/u/1234567/publikPholder/textytext.txt

One would think that jumping up one level to the directory in the URL...

http://dl.dropbox.com/u/1234567/publikPholder/

...would show all the public files. Nope. Nothing but a 404.


回答1:


Looks like this library is pretty complete (although I haven't used it myself), and is probably as simple as (post-auth):

$info = $dropbox->getMetaData('Public', true);
print_r($info['contents']);



回答2:


UPDATE: I found a thread on the Dropbox forums where a user posts a link that claims to enable something pretty close to what I'm asking for. Guess what? It works! I don't know where it came from or where it's documented, but if it's helpful to anyone else, here it is (clicking this link will enable it and I don't know if it can be disabled. Proceed with caution):

https://www.dropbox.com/enable_shmodel

The resulting public folder looks like this:




回答3:


You can use the Dropbox API, specifically the search path. This just returns JSON, which is easy enough to parse.

If you want to just have an index file on your own public Dropbox you can take this approach: http://forums.dropbox.com/topic.php?id=54966.

This generates an index in Python: http://forums.dropbox.com/topic.php?id=17432



来源:https://stackoverflow.com/questions/9764072/retrieve-contents-of-a-public-dropbox-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!