<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<?
$urlrss="http://rss.terra.com.br/0,,EI4795,00.xml";
//$urlrss="http://images.apple.com/main/rss/hotnews/hotnews.rss";
//$urlrss="http://idgnow.uol.com.br/internet/RSS2/index.rss";
//$urlrss="http://www.idgnow.com.br/RSS2/index.rss";
//$urlrss="http://www.idgnow.com.br/computacao_pessoal/RSS2/index.rss";
//$urlrss="http://www.idgnow.com.br/computacao_corporativa/RSS2/index.rss";
//$urlrss="http://www.idgnow.com.br/telecom/RSS2";
//$urlrss="http://rss.terra.com.br/0,,EI4795,00.xml";
//$urlrss="http://rss.terra.com.br/0,,EI306,00.xml";

if (!($fp = fopen($urlrss, "r"))) {
   die("N�o foi possivel abrir a entrada XML.");
}
$xml_parse="";
while ($data = fread($fp, 4096)){
		$xml_parse.=$data;
}
xml_rss_reader($xml_parse,5); //chamada para fun��o: 1� str xml, 2� n�mero de noticias para mostrar
$xml_parse="";//sempre zere a variavel depois da chamada caso queira colocar feeds diferentes na mesma pagina. ou crie outra var.
?>

<?
function xml_rss_reader($xml_parse,$tamanho){

$xml = simplexml_load_string($xml_parse);

echo "<title>".utf8_decode($xml->channel[0]->title)."</title>";

echo utf8_decode($xml->channel[0]->title)."<br>";
echo utf8_decode($xml->channel[0]->description)."<br>";//caso queira que apare�a a desc.
echo utf8_decode($xml->channel[0]->copyright)."<br>";//caso queira que apare�a os direitos de c�pia.
$img=$xml->channel[0]->image[0]->url[0];
if(!empty($img)){echo "<img src='$img' border='0'><br>";}//caso queira que apare�a a img

for($i=0;$i<=$tamanho;$i++){
	$title = $xml->channel[0]->item[$i]->title[0];
	$link = $xml->channel[0]->item[$i]->link[0];
	$description = $xml->channel[0]->item[$i]->description[0];
	$pubDate = $xml->channel[0]->item[$i]->pubDate[0];
	
	echo "<a href='$link' target='_blank'>".utf8_decode($title)."</a><br>";
	//echo utf8_decode($description)."<br>";
	echo utf8_decode($pubDate)."<br>";
}

}//fecha function
?>

</body>
</html>