【问题标题】:Dropbox api not working in codiegniter?Dropbox api 在 codeigniter 中不起作用?
【发布时间】:2015-06-06 01:53:26
【问题描述】:
public function request_dropbox()
{
    $params['key'] = 'gr3kempuvsiqsli';
    $params['secret'] = 'qtdl8lmm9r0rlk1';

    $this->load->library('dropbox', $params); 

    $data = $this->dropbox->get_request_token(base_url());
    $this->session->set_userdata('token_secret', $data['token_secret']);
    redirect($data['redirect']);
}
//This method should not be called directly, it will be called after 
//the user approves your application and dropbox redirects to it
public function access_dropbox()
{
    $params['key'] = 'gr3kempuvsiqsli';
    $params['secret'] = 'qtdl8lmm9r0rlk1';

    $this->load->library('dropbox', $params);
    $oauth = $this->dropbox->get_access_token($this->session->userdata('token_secret'));        
    $this->session->set_userdata('oauth_token', $oauth['oauth_token']);
    $this->session->set_userdata('oauth_token_secret', $oauth['oauth_token_secret']);
    redirect('welcome/test_dropbox');
}
//Once your application is approved you can proceed to load the library
//with the access token data stored in the session. If you see your account
//information printed out then you have successfully authenticated with
//dropbox and can use the library to interact with your account.
public function test_dropbox()
{
    $params['key'] = 'gr3kempuvsiqsli';
    $params['secret'] = 'qtdl8lmm9r0rlk1';
    $params['access'] = array('oauth_token'=>urlencode($this->session->userdata('oauth_token')),
                              'oauth_token_secret'=>urlencode($this->session->userdata('oauth_token_secret')));

    $this->load->library('dropbox', $params);

    $dbobj = $this->dropbox->account();

    print_r($dbobj);

}

块引用 我用过 Dropbox 库https://github.com/jimdoescode/CodeIgniter-Dropbox-API-Library 当我调用函数 request_dropbox() 时,它在 api 中出现错误“致命错误:在第 478 行调用 C:\xampp\htdocs\reports\application\libraries\Dropbox.php 中的未定义函数 curl_init()” 请帮助我如何访问保管箱文件。

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    请仔细查看您的错误,事实证明您的 Xampp 环境中未启用 curl。

    这应该可以帮助您启用 CURL 并让您重新开始。

    How to enable curl in xampp?

    【讨论】:

    • 没问题@NomanKhan 你能把我的答案标记为已回答吗?非常感谢!
    • 你在这个 api 上工作过吗?我正在从 Dropbox 帐户中检索文件。如果你已经解决了,请帮助我。
    猜你喜欢
    • 1970-01-01
    • 2016-11-05
    • 2019-06-26
    • 1970-01-01
    • 1970-01-01
    • 2017-06-17
    • 2021-03-30
    • 2016-09-07
    • 2012-12-16
    相关资源
    最近更新 更多