Following on from the Twitter Search script comes this one that allows me to view my Twitter Stream.

Twitter as you know is a page that is blocked at work and as someone who has an interest in what is going on in the world this dissapoints me.

The script was made possible thanks to a service called GTweet which after you authorise it produces a publicly available RSS feed of your stream which my script uses for it’s output.

This script integrates with my other Twitter script to give you a full Twitter experience.

require_once('rss_php.php');
include('simple_html_dom.php');
echo "
<h1>Twitter Stream</h1>
<div class="tweets">";
$url = $_POST["u"]; // get the URL supplied

$rss = new rss_php;
if ($url != ""){ // if the URL is not blank then use it
@$rss->load(htmlspecialchars($url));
}else{ // otherwise use my URL
@$rss->load('http://gtweetapp.appspot.com/feed/oa-04c782c3-4f07-48a0-b392-3b64211bbd54/with-friends');
}
$tweets = $rss->getItems(); // get items from the RSS feed

foreach ($tweets as $tweet){
$html = new simple_html_dom();
$html->load($tweet['description']);

$usr = $html->find('td a',0);
$usrl = $usr->plaintext; // username on it's own
$usr = $usr->outertext; // username with <a> and the lot
$usr = str_replace("<strong>","",$usr); // used to stop my css applying to the username
$usr = str_replace("</strong>","",$usr);
$usr = str_replace("http://twitter.com/","http://www.robmcghee.com/programming/twitter-searching/?n=10&u=".$usrl,$usr);</a>

<a>$posts = $html->find('font',0);
$posts = explode("
",$posts);
$post = $posts[0];
$post = str_replace("http://twitter.com/","http://www.robmcghee.com/programming/twitter-searching/?n=10&u=",$post);
$post = str_replace("http://search.twitter.com/search?q=%23","http://www.robmcghee.com/programming/twitter-searching/?h=",$post);
$post = str_replace("href=\"http://twitpic.com","href=\"http://m0usey.appspot.com/twitpic.com",$post);
$post = str_replace("href=\"http://yfrog.com","href=\"http://m0usey.appspot.com/yfrog.com",$post);
$post = str_replace("href=\"http://plixi.com","href=\"http://m0usey.appspot.com/plixi.com",$post);

echo $usr .": ". $post ."

"; // print the username and post
}
echo "

</a></div>
<a>

</a><a>";
?>