通过Dropbox Ruby API共享文件夹 [英] share folder via Dropbox Ruby API

查看:81
本文介绍了通过Dropbox Ruby API共享文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过Ruby API共享一个保管箱文件夹。
现在有可能还是存在吗?

I want to share a dropbox folder via the Ruby API. Is it possible now or is there anyway?

谢谢

推荐答案

总有一种方法,但是在这种情况下,它将需要您通过cURL以编程方式登录并来回传递所需的数据。我想自己弄清楚这一点。

There is always a way, but in this case it would require you to login programmatically via cURL and pass back and forth the data needed. I am trying to figure that out now myself.

由于对该线程仍然有兴趣我将发布基本说明,自从我执行此操作以来,它可能已更改,但这是六个月前起作用的。

Since there's still interest in this thread I'll post the basic instructions, it may have changed since I did this, but this is what was working 6 months ago.

1)您需要登录并记住你的饼干。

1) You need to log in and remember your cookies.

登录URL为($) https://www.dropbox.com/login

您需要发布到登录页面的数据在下面以php数组表示,因为这就是我使用的数据。

The data you need to post to the login page is below represented as a php array since that's what I used.

$loginData = array(
    't' => $loginToken,
    'login_email' => $_POST['input_from_email'],
    'login_password' => $_POST['input_from_email_password']
);

登录令牌是登录表单的一部分,它可以防止XSS,因此您需要从

The login token is part of the login form and is to prevent XSS so you need to read it from there and include it in your form post or else it will fail.

成功登录后,您需要使用cURL作为URL <$的cURL读取HTML和标题。 c $ c> https://www.dropbox.com/home 并解析

Once you successfully login you have need to read in the HTML and headers using cURL for the url https://www.dropbox.com/home and parse the

preg_match("/.*TOKEN:(.*),.*/", $homeResponse, $homeResponseMatches); 

这将为下一个表单(提交并创建共享的表单)提取XSS令牌。通过发布到URL https://www.dropbox.com/share_ajax/new 使用它。并且需要发布的数据是。

This pulls the XSS token for the next form which is the form that submits and creates the share. it is used by posting to the URL https://www.dropbox.com/share_ajax/new. and the data that needs to be posted is.

$createShareData = array(
    'emails' => $_POST['input_to_email'],
    'custom_message' => $_POST['input_message'],
    'folder_name' => $_POST['input_folder_name'],
    't' => $loggedInToken
);

'$ loggedInToken'是您从 https:// www抓取的令牌.dropbox.com / home 。这将创建一个新文件夹并将其与电子邮件字段中的电子邮件共享,该字段是用逗号分隔的电子邮件地址列表。

'$loggedInToken' is the token you scraped from https://www.dropbox.com/home. This will create a new folder and share it with the emails in the 'emails' field which is a comma delimited list of email addresses.

玩得开心。

这篇关于通过Dropbox Ruby API共享文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆