Search code examples
apicodeignitertumblr

Use normal PHP libraries in CodeIgniter


I'm new to CodeIgniter and I'm trying to use the Tumblr php library; however I'm not sure how can I adapt it to work with CodeIgniter (if such thing is possible).

I managed to find a few Tumblr CI libraries but they don't provide all the methods available (like tag searching), and the most advanced by BIOSTALL only supports the v1 of the Tumblr API.

Any advices?


Solution

  • You need to do these steps:

    1. Download Tumblr API library for CodeIgniter here
    2. tumblr.php (in config folder) put on your config folder
    3. Change the config file with your parameters:

      $config['tumblr_consumer_key']            = '';
      $config['tumblr_secret_key']          = '';
      $config['tumblr_url']                 = 'good.tumblr.com';
      $config['callback_url']                   = 'controller/method';
      $config['auth_callback']              = 'controller/method';
      
    4. Tumblr.php (in library folder) put on your library folder

    5. OAuth.php (in third_party folder) put on your third_party (create if didn't exist).
    6. Use it. For example:
    $this->load->library('Tumblr');
    $blog_info = $this->tumblr->blog_info();
    // Blog info returned in object
    echo $blog_info->title; // echo blog title