Using Twitter API with Ajax
In this section, we will see how to create a tool using PHP and Ajax that uses Twitter search API to retrieve the tweets from the user containing the searched for keyword. We will use Ajax, PHP, and Twitter API to make this tool.
Getting ready
You can call the Twitter search API as follows:
http://search.twitter.com/search.format?q=your_query_string
In the previous call, the format
can be replaced with json
or atom
. Furthermore, we can make a JSONP call with the extra callback
parameter.
http://search.twitter.com/search.format?q=your_query_string&callback=?
Let's suppose we want to search tweets with php in the search keyword and have the response in JSON format; then we can call the Twitter API like the Twitter API like this:
How to do it...
Here you can see the interface of the Twitter search application using Ajax. This is a very simple interface with minimal CSS. There is a textbox where user the enters the search keyword...