Tumblr API(v2) library for PHP
require_once 'Tumblr.php';
$configs = array('consumerKey' => $consumerKey,
'consumerSecret' => $consumerSecret);
$tumblr = Tubmlr($configs);
// get Zend_Oauth_Consumer instance
$oauthConsumer = $tumblr->getOauthConsumer();
// fetch a request token from Tumblr
$requestToken = $oauthConsumer->getRequestToken();
// persist the token to storage
$_SESSION['TUMBLR_REQUEST_TOKEN'] = serialize($requestToken);
// redirect the user
$oauthConsumer->redirect();
$configs = array('consumerKey' => $consumerKey,
'consumerSecret' => $consumerSecret);
$tumblr = new Tumblr($configs);
if (!empty($_GET) && isset($_SESSION['TUMBLR_REQUEST_TOKEN'])) {
$oauthConsumer = $tumblr->getOauthConsumer();
// fetch a access token from Tumblr
$accessToken = $oauthConsumer->getAccessToken($_GET, unserialize($_SESSION['TUMBLR_REQUEST_TOKEN']));
$_SESSION['TUMBLR_ACCESS_TOKEN'] = serialize($accessToken);
// Now that we have an Access Token, we can discard the Request Token
$_SESSION['TUMBLR_REQUEST_TOKEN'] = null;
}
$accessToken = unserialize($_SESSION['TUMBLR_ACCESS_TOKEN']);
// setting up a Zend_Oauth_Token_Access instance
$tumblr->setOauthTokenAccess($accessToken);
$dashboard = $tumblr->retrieveUsersDashboard();
require_once 'Zend/Oauth/Consumer.php';
$configs = array('requestTokenUrl' => 'http://www.tumblr.com/oauth/request_token',
'authorizeUrl' => 'http://www.tumblr.com/oauth/authorize',
'accessTokenUrl' => 'http://www.tumblr.com/oauth/access_token',
'consumerKey' => $consumerKey,
'consumerSecret' => $consumerKeySecret);
$oauthConsumer = new Zend_Oauth_Consumer($configs);
$configs = array('oauthConsumer' => $oauthConsumer);
$tumblr = new Tumblr($configs);
$oauthConsumer = $tumblr->getOauthConsumer();
... // reference to Example #1-1 and #1-2
$configs = array('consumerKey' => $consumerKey,
'consumerSecret' => $consumerSecret,
'accessToken' => $accessToken,
'accessTokenSecret' => $accessTokenSecret);
$tumblr = Tumblr($configs);
$dashboard = $tumblr->retrieveUsersDashboard();
$tumblr = Tumblr();
$tumblr->setConsumerKey($consumerKey);
$tumblr->setConsumerSecret($consumerSecret);
$tumblr->setAccessToken($accessToken);
$tumblr->setAccessTokenSecret($accessTokenSecret);
$dashboard = $tumblr->retrieveUsersDashboard();
$tumblr = new Tumblr($configs);
$info = $tumblr->retrieveBlogInfo($hostname);
$tumblr = new Tumblr($configs);
$avatar = $tumblr->retrieveBlogAvatar($hostname, $size);
$tumblr = new Tumblr($configs);
$followers = $tumblr->retrieveBlogsFollowers($hostname, $parameters);
$tumblr = new Tumblr($configs);
$posts = $tumblr->retrievePublishedPosts($hostname, $parameters);
$tumblr = new Tumblr($configs);
$queued = $tumblr->retrieveQueuedPosts($hostname);
$tumblr = new Tumblr($configs);
$draft = $tumblr->retrieveDraftPosts($hostname);
$tumblr = new Tumblr($configs);
$submission = $tumblr->retrieveSubmissionPosts($hostname);
$tumblr = new Tumblr($configs);
$post = $tumblr->createBlogPost($hostname, $parameters);
$tumblr = new Tumblr($configs);
$edit = $tumblr->editBlogPost($hostname, $postId, $parameters);
$tumblr = new Tumblr($configs);
$reblog = $tumblr->reblogPost($hostname, $postId, $reblogKey, $parameters);
$tumblr = new Tumblr($configs);
$delete = $tumblr->deletePost($hostname, $postId);
$tumblr = new Tumblr($configs);
$info = $tumblr->retrieveUsersInfo();
$tumblr = new Tumblr($configs);
$dashboard = $tumblr->retrieveUsersDashboard($parameters);
$tumblr = new Tumblr($configs);
$likes = $tumblr->retrieveUsersLikes($parameters);
$tumblr = new Tumblr($configs);
$following = $tumblr->retrieveUsersFollowing($parameters);
$tumblr = new Tumblr($configs);
$follow = $tumblr->followBlog($blogUrl);
$tumblr = new Tumblr($configs);
$unfollow = $tumblr->unfollowBlog($blogUrl);
$tumblr = new Tumblr($configs);
$like = $tumblr->likePost($postId, $reblogKey);
$tumblr = new Tumblr($configs);
$unlike = $tumblr->unlikePost($postId, $reblogKey);
Zend_Rest_Client Zend_Oauth_Consumer
Please see Tumblr API appendix for more detailed information: http://www.tumblr.com/docs/en/api/v2
PHP 5.3.8 Zend Framework 1.11.0
This library is Copyright (c) 2011 aoiaoi and is licensed under the New BSD License. Tumblr is Copyright (c) Tumblr, Inc. It is NOT affiliated with Tumblr, Inc.