Skip to content

Instantly share code, notes, and snippets.

@beweinreich
Created August 1, 2012 17:16
Show Gist options
  • Save beweinreich/3228934 to your computer and use it in GitHub Desktop.
Save beweinreich/3228934 to your computer and use it in GitHub Desktop.
Twitter Parser
<?
$username = "roundedco";
$limit = 5;
$feed = 'http://twitter.com/statuses/user_timeline.rss?screen_name='.$username.'&count='.$limit;
$tweets = file_get_contents($feed);
$tweet = explode("<item>", $tweets);
$tcount = count($tweet) - 1;
for ($i = 1; $i <= $tcount; $i++) {
$endtweet = explode("</item>", $tweet[$i]);
$title = explode("<title>", $endtweet[0]);
$content = explode("</title>", $title[1]);
$mytweets[] = $content[0];
}
while (list(, $v) = each($mytweets)) { ?>
<?=$v;?><br />
<? } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment