Brian Moreau

Search this website


Plasma
Home
|
Solutions
|
Portfolio
|
Articles
|
Projects
|
Photography
|
Technology news
|
Blog
|
Contact
 
 
 

Twitter User Status Timeline
Demonstration of retrieving tweets or status from a named Twitter user

The Twitter documentation can be found at GET statuses/user_timeline
The returned data is available in json, xml, rss, atom formats, and does not require authorisation allowing me to retrieve the data with very little code.

The data is located at
http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=brianmoreau&count=5

Besides the essential screen_name and data format there are some other variables you can make use of in the URL however I have only included the count variable which controls how many tweets or status to return. This function is also rate limited.

Using PHP
$xml = simplexml_load_file('http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=brianmoreau&count=5');
foreach($xml->children() as $child) {
                        # GET time and date data
                        $dateArray = $child->created_at;
                        $dateTimeString = $dateArray[0];
                        # GET date
                        $dateCreated = substr($dateTimeString,0,11);
                        # GET time
                        $timeCreated = substr($dateTimeString,11,9);
                        # GET tweet
                        $tweet = $child->text;
}

You are then free to use this data in as many creative and most imaginative ways you can devise.

 
 
 

Forward:

You may also like to read my article on “is their a point to twitter”  

I am also working on a project that allows control of a device connected to a computer by tweeting it. See http://www.brianmoreau.com/network/electronics.php for this.

 
© 2008 Brian Moreau