Data, Maps, Usability, and Performance

API canvas d3 data geo GeoJSON html5 image JavaScript json maps mysql PHP WordPress

Results for tag: oauth

Tumblr API Example using oAuth and PHP

Tumblr API with PHP

I was recently looking at the Tumblr API and oAuth implementation in PHP. At the time, I did not have access to my server to install John Jawed’s oauth pecl package so I looked elsewhere. I did not find a lot of good examples of using oAuth with just PHP, most demos showed using username and password credentials through the old version of the Tumblr API. I wanted to see a complete oAuth example with PHP. Finally, I did find the a thread on the Tumblr API discussion group which had a really simple and well commented example of using oAuth with a modified version of Abraham’s TwitterOAuth library adapted to support the new Tumblr API. I downloaded the zip and was able to make it work, connecting to Tumblr, pressing Allow, and then making some API calls.

But, the example did not show how to make API calls without constantly needing to authenticate the application (press Allow) and I wanted to see an example of just uploading pictures to Tumblr without the extra step. When you register an application with Tumblr, you get an OAuth Consumer Key and a Secret Key for you API calls and oAuth authentication. You also specify a callback url, a place where Tumblr will send you upon successful authentication. Now, it’s important to note that some methods only require the API key (blog info, posts, likes) but any content creation requires oAuth authentication and below I will go over the basic steps of OAuth and explain how to make a post to Tumblr using oAuth, PHP, and a single API call:
Read more