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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?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:
1 |
php twitter.php keyword |
5 replies on “Track Your Favorite Topic on Twitter: A PHP CLI Tool”
[…] This post was Twitted by masnun […]
[…] more from the original source: Track Your Favorite Topic on Twitter: A PHP CLI Tool « maSnun.com […]
[…] Read the original: Track Your Favorite Topic on Twitter: A PHP CLI Tool « maSnun.com […]
[…] This post was mentioned on Twitter by Abu Ashraf Masnun, Telletto. Telletto said: maSnun says… Track Your Favorite Topic on Twitter: A PHP CLI Tool: Here’s a little php utility that will let yo… http://bit.ly/88tABd […]
Twitter gave me a HUGE boost in the Google rankings