Cuelogic Blog Icon
Cuelogic Career Icon
Home > Blog > Product Development > Web > Integration of Tumblr API with PHP

Integration of Tumblr API with PHP

Integration of Tumblr API with PHP

Tumblr provide you facility to share post such as text message, photos, music etc on your Tumblr blogs. In this blog, I have explained about how you can manage Tumblr account using Tumbler API with PHP.

We discussed following functionality  from Tumblr API (V2)

  1. Get user Personal and Blog pages information.

  2. Post or share updates such as media, text, photos, quotes, links etc.

  3. Fetch updates from users profile or blogs.

Create Tumblr application:

  1. Go to . If you have Tumblr account then login with that or create new account.

  1. Register your application with Tumblr to receive an API key.


  2. Once you’ve registered your Tumblr app, you will get an OAuth Consumer Key and Secret Key.


How to use?

1. Download Tumblr API (V2) demo from following link:


2. Update config.php file

Open config.php file and add your Tumblr API key, Secrete key and Call-back URL.


In this demo, I have explored some common Tumblr API (V2) API functions such as get user and blogs profile information, get blog profile updates and post status updates on Tumblr blog pages.


i) Get user access token

You can get Tumblr valid access token from fnGetOauthToken function.

$objTumbOuth = new TumblrOAuth($this->strConsumerKey, $this->strConsumerSecret, $_SESSION['request_token'], $_SESSION['request_token_secret']);

//API Call For Getting API Access Token
$arrAccessToken = $objTumbOuth->getAccessToken($_REQUEST['oauth_verifier']);


ii) Get user and profile information

You can fetch personal profile information as well as blogs profile information using fnGetUserInformation function.

//API Call For Getting User Information
$objArrUserInfo = $this->objTumblrOauth->get('user/info');


iii) Get blog profile updates

You can fetch blogs profile updates using fnGetUserBlogFeed function.

 //Blog Page Post Limit
 $arrParam = array(  
            'offset' => $intStart
            'limit' => $intLimit
            'api_key' => $this->strConsumerKey // App_key

 $strBlogUrl = "blog/YOUR BLOG URL/posts";
 //API Call For Getting Blog update
 $arrProfileUpdates = $this->objTumblrOauth->get($strBlogUrl,   


iv) Post update On blog profile

You can post blogs profile updates using fnPostMessageOnBlog function.

 // Photo Updates
 $arrMessage = array(
              'type' => 'photo', 
              'caption' => 'Photo details',
              'source' =>Image path,
              'format' => 'html'

//Text Updates
$arrMessage = array(
              'type' => 'regular', 
              'title' => 'Testing ', 
              'body' => 'Details', 
              'format' =>'html'

//API Call For Posting Blog update
$arrPost = $this->objTumblrOauth->post($strPostUrl, $arrMessage);

Note : For rest of function please check