.+<\/$container>/sU",$xml, $items); $items=$items[0]; $itemsArray=array(); foreach ($items as $item) { for($i=0; $i|\/>)/sU", $item, $tag); $this[$i]=preg_replace("/<$tags[$i]>(.+)(<\/$tags[$i]>|\/>)/sU",'$1',$tag); $this[$i]=preg_replace("//sU",'$1',$this[$i]); $this[$i]=array_map('html_entity_decode', $this[$i]); } if (count($itemsArray)<$number) {array_push($itemsArray, $this);} } $theData="
"; foreach ($itemsArray as $item) { for($i=0; $i/sU",'$1',$data[2]); $date=$data[3]; $theData.="
$title
$description
Date: $date
\r"; } $theData.="
"; return $theData; } $container='item'; $tags=array('title','description','link','pubDate'); $mtv=xml_parser("http://www.mtv.com/rss/news/latestcached.jhtml?partner=rssMozilla",$container,$tags,5); $bbc=xml_parser("http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",$container,$tags,10); $cnn=xml_parser("http://rss.cnn.com/rss/cnn_topstories.rss",$container,$tags,10); $container='entry'; $tags=array('title','content','link','published'); $flickr=xml_parser("http://api.flickr.com/services/feeds/photos_public.gne",$container,$tags,10); ?> rss/xml parser demo

feeds

mtv

bbc

cnn

flickr