Return to Snippet

Revision: 43148
at March 17, 2011 22:03 by marshall


Initial Code
<ul>

<?php
  $rss = @simplexml_load_file('http://thedailywhat.tumblr.com/rss');
  if ($rss) {
      $i = 0;
      foreach ($rss->channel->item as $item) {
          if (++$i > 7) {
              // stop after 7 items
              break;
          }
          echo "<li><a href='" . $item->link . "'>" . $item->title . "</a></li>\n";
      }
  } else {
      echo "Tumblr is down.";
  }
?>

</ul>

Initial URL
http://marshallim.posterous.com/simplexml-and-php-error-handling-tumblr-rss-e

Initial Description

                                

Initial Title
SimpleXML and PHP Error Handling - Tumblr RSS Example

Initial Tags
xml

Initial Language
PHP