Fala pessoal tenho um script q faz leitura de alguns sites q fornecem conteudo RSS e o mesmo roda localmente e quando jogo ele no servidor web simplesmente nao funciona, o que poderá estar acontecendo, ai vai o source:
[codebox]<?
$feed = 'http://feeds.folha.uol.com.br/folha/educacao/rss091.xml';
$set=8; // 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 untag($string, $tag)
{
$tmpval = array();
$preg = "|<$tag>(.*?)</$tag>|s";
preg_match_all($preg, $string, $tags);
foreach ($tags[1] as $tmpcont){
$tmpval[] = $tmpcont;
}
return $tmpval;
}
$items = untag($xml, 'item');
$html = '<p align="left">';
$i=0;
foreach ($items as $item) {
if ($i < $set){
$title = untag($item, 'title');
$link = untag($item, 'link');
$html .= '<base target="_blank"><font face="verdana" size="1" color="#868686">» <a href="' . $link[0] . '">
<font face="verdana" size="1" color="#868686">' . $title[0] . "</a></font></b><br><br/>\n";
$i++;
}
}
$html .= '</p>';
echo $html;
?>[/codebox]
Obrigado desde já

Rss Roda Local E Na Web Não Pq?
Started By spymam, 23/08/2007, 00:43
1 reply to this topic
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)