douyu4535 2013-03-07 21:31
浏览 34

Dropbox使用PHP创建一个没有cURL的文件夹

I am following this tutorial http://fabi.me/en/php-projects/dropphp-dropbox-api-client/.

I managed to authenticate the app using the sample.php and tested it using the sample.php

Now I am trying to create a folder using the SDK but I do not know how to go about it. At points 2 and 3 the code seems garbled.

I tried this till now:

<?php

error_reporting(E_ALL);
require_once("DropboxClient.php");


$dropbox = new DropboxClient(array('app_key' => "YOUR_APP_KEY",
'app_secret'=> "YOUR_APP_SECRET",'app_full_access' => false,),'en'); 


$this->apiCall("fileops/create_folder", "POST", array('root' => , 'path' => ));
?>

I obviously changed YOUR_APP_KEY and YOUR_APP_SECRET with my own for security reasons.

I can't manage to create the folder / directory. Is there something wrong in my php code?

  • 写回答

1条回答 默认 最新

  • dphg63476 2013-03-07 21:44
    关注

    Try add curl_setopt($context, CURLOPT_UPLOAD,1);

    If you are on VPS do I removed the 1.1.0 (sudo pecl uninstall oauth), than downloaded 1.0.0 from the oauth page and built oauth.so from source, and since then everything work.;

    For DropPHP disable cURL as: $myDropPHP->SetUseCurl(false);

    If you didn't sure why isn't work try dump a data as simple:

    $dump = $this->apiCall("fileops/create_folder", "POST", array('root' => , 'path' => ));
    var_dump($dump); exit;
    

    This will go to you for find why is error or not working... Or view on log PHP file for errors (tail -f /var/log/error.log)

    Or... https://serverfault.com/questions/485285/install-oauth-extension-for-php-in-debian-wheezy

    Try using DROPBOX PEAR: http://pear.dropbox-php.com/

    You can instead of this fix, use DROPBOX PHP API client: http://www.dropbox-php.com/

    This code you have it's maybe outdated or conflicted with some library for an older version (worked) but on newer not solved. This needs manually change in code. Use DROPBOX PHP API client on above link and tell if it's worked.

    I found a Dropbox API on Codecanyon look at simple YT link: http://www.youtube.com/watch?v=Y3Gy5Ci3sog

    评论

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了