<?php $feed = 'http://g1.globo.com/dynamo/rss2.xml'; $set=5; // AKI VC COLOCA O NUMERO DE NOTICIAS QUE VC QUER QUE APAREĆA ini_set('allow_url_fopen', true); $fp = fopen($feed, 'r'); $xml = ''; while (!feof($fp)) { $xml .= fread($fp, 128); } fclose($fp); function untag2($string, $tag) { $tmpval = array(); $preg = "|<$tag>(.*?)</$tag>|s"; preg_match_all($preg, $string, $tags); foreach ($tags[1] as $tmpcont){ $tmpval[] = $tmpcont; } return $tmpval; } $items = untag2($xml, 'item'); $html = '<p align="center">'; $i=0; foreach ($items as $item) { if ($i < $set){ $title = untag2($item, 'title'); $link = untag2($item, 'link'); $html .= '<base target="_blank"><font face="verdana" size="1" color="#006699"><a href="' . utf8_decode ($link[0]) . '">' . utf8_decode ($title[0]) . "</a></font></b><br/><br>\n"; $i++; } } $html .= '</p>'; echo $html; ?>