简体   繁体   English

如何使用新改进的Dropbox-PHP API?

[英]How can I use the newly revamped Dropbox-PHP API?

I would like to use the Dropbox-PHP API that has recently come under development again. 我想使用最近再次开发的Dropbox-PHP API。 It is located here: http://code.google.com/p/dropbox-php/ 它位于: http//code.google.com/p/dropbox-php/

I did cloned it with hg clone https://dropbox-php.googlecode.com/hg/ dropbox-php and I get this file structure: 我用hg clone https://dropbox-php.googlecode.com/hg/ dropbox-php克隆了它,我得到了这个文件结构:

Dropbox/API.php
Dropbox/autoload.php

Dropbox/Exception/Forbidden.php
Dropbox/Exception/NotFound.php
Dropbox/Exception/OverQuota.php
Dropbox/Exception/RequestToken.php
Dropbox/Exception.php

Dropbox/OAuth/PEAR.php
Dropbox/OAuth/PHP.php
Dropbox/OAuth/Zend.php
Dropbox/OAuth.php

examples/accountinfo.php
examples/createaccount.php
examples/download_image.php
examples/getmetadata.php
examples/oauth_workflow.php
examples/uploading.php

But I get this error when trying to run accountinfo.php (or example): 但是在尝试运行accountinfo.php(或示例)时出现此错误:

Warning: include(Dropbox/autoload.php) [function.include]: failed to open stream
No such file or directory in dropbox-api/examples/accountinfo.php on line 7

Right, so then I move the Dropbox folder inside of where all the example files are and still get an error message: 是的,那么我将Dropbox文件夹移动到所有示例文件所在的位置,并仍然收到错误消息:

Fatal error: Uncaught exception 'Dropbox_Exception' with message 'The OAuth class
could not be found! Did you install and enable the oauth extension?' in
examples/Dropbox/OAuth/PHP.php:36 Stack trace: #0 examples/accountinfo.php(9):
Dropbox_OAuth_PHP->__construct('', '') #1 {main} thrown in
examples/Dropbox/OAuth/PHP.php on line 36

So I'm obviously not doing something right but I have no idea what. 所以我显然没有做对,但我不知道是什么。

Also saw on the site where it has instructions on installing: 还在网站上看到有安装说明:

pear channel-discover pear.dropbox-php.com
pear install dropbox-php/Dropbox-alpha

I ran those two commands and it still won't work. 我运行了这两个命令,它仍然无法正常工作。 I don't usually have any problems coding in PHP but the lack of documentation is a little frustrating. 我在PHP中编码通常没有任何问题,但缺少文档有点令人沮丧。

Update 更新

As noted in the accepted answer below my main problem was not having oAuth installed on the system. 如下面接受的答案中所述,我的主要问题是没有在系统上安装oAuth。 I'm running OS X 10.6 - if someone can provide some clear and easy instructions on how to build / install this to work with XAMPP / PHP 5.3 I will accept your answer. 我正在运行OS X 10.6 - 如果有人可以提供一些关于如何构建/安装它以使用XAMPP / PHP 5.3的清晰简单的说明,我会接受你的答案。 I've tried the articles online about using homebrew and such but these are flaky and do not seem to work for me. 我已经尝试过在线使用自制软件等文章,但这些文章都是片状的,似乎对我不起作用。 Guessing I will have to build / install it from scratch. 猜测我将不得不从头开始构建/安装它。

The Dropbox folder needs to be inside one of the folders in your include_path. Dropbox文件夹需要位于include_path中的一个文件夹中。

Edit: 编辑:
Also oauth needs to be "installed" on the system and included in php.ini (when you do phpinfo() oAuth should show up as a module). oauth也需要在系统上“安装”并包含在php.ini中(当你执行phpinfo()时,oAuth应该显示为一个模块)。 then things should work. 事情应该有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM