Yii 1.1: yiidropbox

Extension provide methods Dropbox API
18 followers

YiiDropbox

This Extension based on Dropbox client library for PHP

Install

  • Download YiiDropbox.php.
  • Create in your extensions folder YiiDropbox folder.
  • Move downloaded YiiDropbox.php file to YiiDropbox extension folder.

In app config:

'components'=>array(
    ...
 
    'dropbox' => array(
        'class' => 'ext.YiiDropbox.YiiDropbox',
        'appKey' => 'YOUR APP KEY',
        'appSecret' => 'YOUR SECRET KEY',
        'root' => 'dropbox' //or 'sandbox'
    ),
 
    ...
);

Usage

$dropbox = Yii::app()->dropbox;
 
  //First step. Connect to dropbox
  $request = $dropbox->getRequestToken();
  Yii::app()->session->add('request', $request); //Save this tokens
  $link = $dropbox->getAuthorizeLink('path/to/callback'); //Show this link to user
 
  /**
   * This code from callback function
   */
  $dropbox->setToken(Yii::app()->session->get('request')); // Set request tokens
  $tokens = $dropbox->getAccessToken(); // get Access tokens
  Yii::app()->session->add('dropbox', $tokens); //save request tokens. It's tokens we can save in db and use
 
  /**
   * if we get access tokens from database or other storage, we must set tokens by:   * 
   */
  $dropbox->setToken($tokens);
 
  /**
   * Now we can use API methods
   */
  $dropbox->getAccountInfo();
  $dropbox->getFile('path/to/file');
  $dropbox->putFile('path/to/file', 'path/to/file/on/server');
  ...

Links

GitHub repo

Total 7 comments

#16254 report it
retomi at 2014/02/03 03:20pm
OAuth.php

Need to install OAuth

pecl install oauth

If you get an error no "phpize", install the "php5-dev". And then if you get an error "php_pcre.h" during compilation, then you need to install the "libpcre3-dev" package ubuntu.

#14860 report it
IAmSalnikov at 2013/09/16 09:07am
#14857

include(oauth.php) [function.include]: failed to open stream: No such file or directory

check oauth php extension on your server

#14857 report it
maxxdev at 2013/09/16 07:51am
OAuth.php

include(OAuth.php) [function.include]: failed to open stream: No such file or directory

#14617 report it
yokesh28 at 2013/08/29 03:33am
OAuthException

Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)

i was getting this error.. i was working in localhost. the credential are correct i have verified it. why have getting this error repeatedly

#14581 report it
IAmSalnikov at 2013/08/24 08:26am
Errors

Sorry for this errors. I fix it. (Little problems with server).

#14576 report it
realtebo at 2013/08/24 05:50am
Your example is broken

Fatal error: Call to undefined function curl_init() in /var/www/iamsalnikov.ru/protected/extensions/VKApi/VKApi.php on line 715

#13696 report it
Ninad at 2013/06/18 05:55am
Yii Dropbox

Getting error include(OAuth.php): failed to open stream: No such file or directory while using this extension

Leave a comment

Please to leave your comment.

Create extension
Downloads