Twitter API using PHP made easier with library oauth_twitter.php

OAuth_Twitter.php is a library which makes a layer between your twitter App and Twitter API. If OAuth_Twitter.php is included inside your code, which acts as a gate way for your Application to Twitter API, you can access Twitter data using the methods of this Library.

Setting up the coding environment
As stated above OAuth_Twitter.php uses Zend OAuth package in its backend. So it requires OAuth package in your code base. This package is included in the latest version of Zend Framework or you can download it from code.google. :-) . Once its done you can download OAuth_Twitter.php from git repository, and copy to proper include path. A detailed documentation is also provided with this, to make your journey easier.

How to use this Library
This library provides a class ‘OAuth_Twitter’ which accepts your twitter app configuration data which is provided by Twitter at the time of Registering the app. This configurations have to be provided to the class as an array.

$my_twitter = new OAuth_Twitter($configuration);

Most of the functions require twitter authentication to complete. So it will redirect to twitter authentication page, and on successful authentication it will redirect to the callback url of your app . There the app has to save the access token for other functions to work with the same session. This will be done using the following function

$my_twitter->handleCallback()

DONE \0/  \0/ \o/

Now you can use the functions directly in you code like

$my_twitter->updateStatus($status)  –> to update your status

$my_twitter->getFollowersByHandle(‘injoosweb’)  –> To get the followers list of injoosweb

$my_twitter->getFollowersByHandle(‘injoosweb’)  –> To get the followers list of injoosweb

$my_twitter->getPublicUpdatesByHandle(’injoosweb’) –> To know whats happening in injoos :-)

Start Rocking ……….

Bookmark and Share

1 comment to Twitter API using PHP made easier with library oauth_twitter.php

  1. Time Synchronisation
    April 15th, 2010 at 5:14 am

    MySpace…

    This post was mentioned on MySpace by Richard Hawkesford….

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Connect with us

Twitter  Facebook  Linked in  You tube  Myspace  Flickr  Slideshare