Follow Us on Twitter

Write your own twitter app!!

Most probably you are already into twitter. And you must already be part of the tweet phenomenon. It is one of the most exciting social networking and net blogging site with has come up with a huge following.

Twitter has been a runaway success since the status message inspired web app launched about a year ago. Its rapid adoption, ease of use and extensibility resulted in a lot of excited developers taking Twitter’s best bits and mixing them up to their own ends. Frantic Industries and the Twitter Fan Wiki together present a comprehensive list of Twitter mash-ups and extensions. You can also develop twitter apps like many have done.

Twitter, just like many other Web2.0 sites, has an excellent API. So much so, writing a twitter app is considered to be “Hello World” of Web2.0 Programming.

Twitter apps can be developed by you as well. Every Twitter application makes use of the Twitter API, which is well documented on the Twitter API wiki. Twitter application can be developed with Java, PHP etc.

Lets say in PHP it can be done like this:

  • Have PHP manual open for reference.
  • To receive (or send) any info from(to) twitter, you will have to do a POST  or GET  request to twitter. There are different URL’s(methods) for different operations as mentioned in the API documentation.
  • Based upon the application that you are developing, you will use appropriate API methods.
  • These methods return XML, JSON,  RSS and Atom depending upon the request that you send (http://twitter.com/statuses/public_timeline.format here  format can be xml or json, etc.,) .
  • Generally use  XML, but you can also use JSON.
  • PHP has functions that help you easily read these formats.
  • Next task is to parse it & interpret the information. Then we need to do the processing as per the applications needs.
  • Then comes the last but the most challenging part, presenting the information to the user.
  • AJAX stuff are popular these days, so learn a little bit of jQuery( because there isn’t any other easy way of ajaxyfying that I know of) if you want.
  • You can easily present the information in a HTML page with some neat stying using css.

To better understand the process you need to go through entire steps done to create an application in Twitter in PHP. For that please go to the site which tells you how to create an application which lets you find common friends between two people.

Developing twitter application in Java:

You can also write Twitter applications in Java. An example would enable you to understand the finer details for doing the same.

In the example an application that accesses tweets via the Twitter API and archives them in the form of a PDF file is built.

The application is built with the help of three open source Java libraries:

* HttpClient 3.x from the Apache Commons library. You’ll use this API to obtain an XML stream of tweets from the Twitter API, as well as the Commons Logging and Codec components.
* dom4j to parse the XML and extract specific data from each tweet.
* iText to create the PDF document.

It is a hands-on tutorial, so download those libraries if you haven’t already done so. You need to have an twitter account to make this application work.
The tutorial begins by writing a Twitter application as a standalone Java program. Eventually it tells you how to  integrate the code in a servlet, so that you can offer the application on your site as a service available to other Twitterati.

For the detail steps visit the following link.

Twitter applications can also be written using Swing, Twitter4j etc. apart from Java. For an example for the same visit the here.

For developing applications in twitter whether it is through Java or through PHP or any other framework you need to have a good idea about the API. So what are you waiting for jump on to the bandwagon and create your own app. Share with me if you do create an application.

Related

Tags: , , , , , , , ,
Subscribe to Comments RSS Feed in this post

2 Responses

  1. Good post.Very informative.Thank you for knowledge transfer.