Tumblr is the most popular social platform for setting up your blogs. Tumblr has provided Tumblr API to make any operation on your Blogs. In this article, i am explaining the simplest procedure to integrate Tumblr API.
Steps to Configure Tumblr API with PHP
First register an app to get consumer key and secret. Click the link below
You will see the form like below:
Administrative contact email field will contain the email id registered with your Tumblr account. Provide a valid value in Default callback URL
Application Website, App Store URL and Google Play Store URL can be left blank at the moment. And submit the form. On next page you will get your OAuth Consumer key and secret key.
Just save these for future use.
Now to obtain, Oauth token and token secret, go to the following URL:
Here input your Consumer Key and Consumer Secret and click Authenticate to get the Oauth token and token secret along with PHP code to set up the authentication.
If keys are not shown, you can see those by clicking the show keys button on the top.
Now Lets us Start Some Coding Work
To get the api code, you just need to get the PHP repository available at GitHub. But the best way to get this code to install this repository using composer, like i did.
You May Also Like:
How to Make Soap Client Call in PHP
Create and Save XML file Using MySQL Data in PHP
Configure Intercom API in PHp and Create New User in It
GitHub Tutorial: Commit, Push And Go
How to Integrate Instagram API into Website
How to Create Rss Feed Script Using PHP and MySQL
Open command prompt and go to the path where you want to install the repository, and type the command
php composer.phar require tumblr/tumblr
C:\xampp\htdocs\tumblr >php composer.phar require tumblr/tumblr
This will install the Tumblr repository at your system along with required dependencies (inside C:\xampp\htdocs\tumblr directory,in my case.) Now on the root path, create “sample.php” with following code:
$client = new Tumblr\API\Client(
'Your Oauth Consumer Key',
'Your Consumer Secret',
'Your OAuth Token ',
'Your Token Secret'
$info = $client->getUserInfo();
This will get you the basic information about the Tumblr user. Likewise you can make any other operation on your blog(s) by following the Tumblr api documentation.
Hope this article would benefit you. Please share if you like this article. Thanks