PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label dropbox-php. Show all posts
Showing posts with label dropbox-php. Show all posts

Wednesday, August 31, 2022

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

 August 31, 2022     api, dropbox, dropbox-php, pear, php     No comments   

Issue

I would like to use the Dropbox-PHP API that has recently come under development again. It is located here: 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:

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):

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:

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.

Update

As noted in the accepted answer below my main problem was not having oAuth installed on the system. 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. 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.


Solution

The Dropbox folder needs to be inside one of the folders in your 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). then things should work.



Answered By - mcrumley
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to get the dropbox-php library with pear HTTP_OAUTH to work?

 August 31, 2022     dropbox-api, dropbox-php, oauth, pear, php     No comments   

Issue

I've been struggelig to get the dropbox-php library to work, but the page where I try to use the classes outputs an error:

Warning: include(HTTP/OAuth/Consumer.php) [function.include]: failed to open stream: No such file or directory in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 47   

Warning: include(HTTP/OAuth/Consumer.php) [function.include]: failed to open stream: No such  file or directory in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 47

Warning: include() [function.include]: Failed opening 'HTTP/OAuth/Consumer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 47

Fatal error: Uncaught exception 'Dropbox_Exception' with message 'The HTTP_OAuth_Consumer class could not be found! Did you install the pear HTTP_OAUTH class?' in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php:51 Stack trace: #0 /home/sensured/public_html/sensured.net/Dropbox/getmetadata.php(11): Dropbox_OAuth_PEAR->__construct('', '') #1 {main} thrown in /home/sensured/public_html/sensured.net/Dropbox/OAuth/PEAR.php on line 51  

The pear HTTP_OAUTH class is installed (v 0.2.3), but its done though cpanel so I'm unsure where and don't even know if that has anything to say.


Solution

You need to make sure that PEAR's PHP directory is in your include_path.

Find the path with

$ pear config-get php_dir

then add it to your php.ini's include_path directive. Restart your web server software afterwards to activate the new settings .



Answered By - cweiske
Answer Checked By - Timothy Miller (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home
View mobile version

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing