Skip to content

Instantly share code, notes, and snippets.

@jelled
Created October 24, 2013 00:16
Show Gist options
  • Save jelled/7129104 to your computer and use it in GitHub Desktop.
Save jelled/7129104 to your computer and use it in GitHub Desktop.
New tumblr post using the tumblr.php library
/* Quick Setup
$ git clone https://github.com/tumblr/tumblr.php.git
$ cd tumblr.php
$ composer install
*/
require_once('vendor/autoload.php');
//Your application keys generated at http://www.tumblr.com/oauth/apps
$consumerKey = 'CONSUMER_KEY';
$consumerSecret = 'CONSUMER_SECRET';
//Your user's keys
$token = 'USER_TOKEN';
$tokenSecret = 'USER_TOKEN_SECRET';
$blogName = 'jelled';
$data = array(
"type" => "text",
"title" => "Test post from the Tumblr API",
"body" => "This body don't quit"
);
$client = new Tumblr\API\Client($consumerKey, $consumerSecret);
$client->setToken($token, $tokenSecret);
$client->createPost($blogName, $data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment