Twitter Wordles
Submitted by Aldon Hynes on Fri, 06/12/2009 - 19:43
Recently, Tamela left a comment on my blog post twitterwordle blog post asking if I was selling the program that I used to create my twitterwordle image.
It is a simple PHP program and instead of selling it, I figured I'd just post it here. In addition, I've set it up on my server so you can access run it (providing I don't run out of bandwidth or access).
To run it, go to http://www.orient-lodge.com/node/3605?user=example
Put in the Twitter name instead of 'example' to get the statuses of the friends for whomever's name you enter.
<?php $u = $_REQUEST["user"]; $page = 1; while(1) { $ch=curl_init(); curl_setopt($ch,CURLOPT_URL,'http://twitter.com/statuses/friends/'.$u.'.xml?page='.$page); curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); $xmlstr = curl_exec($ch); curl_close($ch); try { $xml = new SimpleXMLElement($xmlstr); } catch (Exception $e) { exit; } $i = 0; $uname = $xml->user[$i]->name; if ($uname == '') exit; while($uname != '') { $status = $xml->user[$i]->status->text; print $uname . " : " . $status . "<br>\n"; $i = $i + 1; $uname = $xml->user[$i]->name; } $page = $page + 1; } ?>