Twitter RSS Loop


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. try {
  3. $feed = 'http://twitter.com/statuses/user_timeline/41635238.rss';
  4. $xml = new SimpleXMLElement(file_get_contents($feed));
  5. for($i=0; $i < 5; $i++){
  6. print '<p class="feeditem"><a href="'.$xml->channel->item[$i]->link.'">'.ltrim($xml->channel->item[$i]->description, 'shuffleInteract:').'</a><br /><span>Posted on '.date('F jS, Y', strtotime($xml->channel->item[$i]->pubDate)).'</span></p>';
  7. }
  8. } catch(Exception $e){}
  9. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.