Here’s a little php utility that will let you watch the Twitter public time line for your favorite topic. This is specially helpful for those who want to build some tracking application on the basis of the twitter streaming APIs.
Here’s the source:
<?php $topic = $argv[1]; if(empty ($topic)) { $topic = "php"; } $username = "twitter_username"; $password = "twitter_password"; $fp = fopen("http://{$username}:{$password}@stream.twitter.com/1/statuses/filter.json?track={$topic}","r"); while( $data = fgets($fp) ) { $tweet = json_decode($data,true); if(!empty($tweet['text'])) { echo $tweet['user']['screen_name'].": ".$tweet['text']." \n -------------------- \n"; } } ?>
Run this script with the keyword as the argument:
php twitter.php keyword
Pingback: Twitted by masnun
Pingback: Webby Scripts Track Your Favorite Topic on Twitter: A PHP CLI Tool « maSnun.com
Pingback: Track Your Favorite Topic on Twitter: A PHP CLI Tool « maSnun.com | Coder Online
Pingback: Tweets that mention Track Your Favorite Topic on Twitter: A PHP CLI Tool « maSnun.com -- Topsy.com
Twitter gave me a HUGE boost in the Google rankings