PHP xml rss reader


SUBMITTED BY: Guest

DATE: Oct. 22, 2013, 1:41 p.m.

FORMAT: PHP

SIZE: 495 Bytes

HITS: 1041

  1. <?php
  2. $html = "";
  3. $url = "http://www.developphp.com/feed_latest_texttuts.php";
  4. $xml = simplexml_load_file($url);
  5. for($i = 0; $i < 10; $i++){
  6. $title = $xml->channel->item[$i]->title;
  7. $link = $xml->channel->item[$i]->link;
  8. $description = $xml->channel->item[$i]->description;
  9. $pubDate = $xml->channel->item[$i]->pubDate;
  10. $html .= "<a href='$link'><h3>$title</h3></a>";
  11. $html .= "$description";
  12. $html .= "<br />$pubDate<hr />";
  13. }
  14. echo $html;
  15. ?>

comments powered by Disqus