RSS Code with Magpie RSS Feeder


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

need the magpie code


Copy this code and paste it in your HTML
  1. <?
  2. $url = 'http://www.weatheroffice.gc.ca/rss/city/on-7_e.xml';
  3. $num_items = 1;
  4. //$rss = fetch_rss( $url );
  5. $rss = fetch_rss($url);
  6. $items = array_slice($rss->items, 0, $num_items);
  7.  
  8.  
  9.  
  10. echo "Channel Title: " . $rss->channel['title'] . "<p>";
  11. echo "<ul>";
  12. foreach ($rss->items as $item) {
  13. $href = $item['link'];
  14. $title = $item['title'];
  15. echo "<li><a href=$href>$title</a></li>";
  16. }
  17. echo "</ul>";
  18. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.