Posted By

nielsenrc on 01/18/11


Tagged


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

silverskymedia
mgerdt
geldora


Twitter RSS Feed


 / Published in: PHP
 

  1. print "<br />";
  2.  
  3. $feed = file_get_contents('http://twitter.com/statuses/user_timeline/25556798.rss');
  4. $xml = new SimpleXMLElement($feed);
  5. $i = 0;
  6. foreach ($xml->channel->item as $feed) {
  7. $patterns = array();
  8. $patterns[0] = '/00:00:00/';
  9. $patterns[1] = '/-0500/';
  10. $patterns[2] = '/-0400/';
  11. $patterns[3] = '/ParadigmRoofing:/';
  12. $replacements = array();
  13. $replacements[0] = ' ';
  14. $replacements[1] = ' ';
  15. $replacements[2] = ' ';
  16. $replacements[3] = ' ';
  17.  
  18. $cleanedtitle = preg_replace($patterns, $replacements, $feed->title);
  19.  
  20.  
  21. echo '<h2><a href=' . $feed->link . '>' . $cleanedtitle . '</a></h2>' . '<br />';
  22.  
  23.  
  24.  
  25. $i++;
  26.  
  27. if($i == 3) {
  28.  
  29. break;
  30. }
  31.  
  32. }

Report this snippet  

You need to login to post a comment.