Dropbox api not working in codiegniter?

China☆狼群 提交于 2019-12-22 18:46:30

问题


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

}

Blockquote i have used Dropbox library https://github.com/jimdoescode/CodeIgniter-Dropbox-API-Library When i call to function request_dropbox() it gives me error in api "Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\reports\application\libraries\Dropbox.php on line 478" please help me how to access dropbox files.


回答1:


Please look at your errors more carefully, it turns out that curl is not enabled on your Xampp environment.

This should help you out to enable CURL and get you going again.

How to enable curl in xampp?



来源:https://stackoverflow.com/questions/29390431/dropbox-api-not-working-in-codiegniter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!