Script para buscar noticias em RSS */ /* Estrutura da tabela criada para armazenar as noticias CREATE TABLE `rss` ( `id` int(11) NOT NULL auto_increment, `url` varchar(200) default NULL, `title` varchar(200) default NULL, `lido` int(11) default NULL, `date` datetime default NULL, `channel` varchar(200) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `uk_title` (`channel`,`title`) ) TYPE=MyISAM AUTO_INCREMENT=30207 ; */ error_reporting(1); include("mag/rss_fetch.inc");// download em http://magpierss.sourceforge.net/ $con = mysql_connect("localhost","eminetto","pass"); mysql_select_db("eminetto",$con); if($_GET[op]=="lido") { //se foi clicado na opção de atualizar as noticias para lidas $sql = "update rss set lido=1"; if($_GET[channel]) $sql .= " where channel='$_GET[channel]'"; $res = mysql_query($sql); topo(); fim(); exit; } elseif($_GET[op]=="busca") { //busca topo(); showRSS($_GET[query]); fim(); exit; } //função que mostra o cabecalho function topo() { ?> :: elm :: Notícias

[Atualizar]    [Marcar todos como Lidos]


channel['title']; foreach($rss->items as $item) { $title = $item[title]; $url = $item[link]; $res = mysql_query("insert into rss values(null,'$url','$title',0,sysdate(),'$channel')"); } } } //funcao que le as noticas na base de dados function showRSS($query='') { if($query) $sql = "select distinct channel from rss where upper(title) like upper('%$query%')"; else $sql = "select distinct channel from rss where lido=0"; $res = mysql_query($sql); while($db = mysql_fetch_object($res)) { echo '
'.$db->channel.'  [Marcar como Lido]
'; if($query) $res1 = mysql_query("select * from rss where channel='$db->channel' and upper(title) like upper('%$query%')"); else $res1 = mysql_query("select * from rss where channel='$db->channel' and lido=0"); while($db1 = mysql_fetch_object($res1)) { echo "url target=_blank>$db1->title ($db1->date)
"; } } } topo(); //busca os arquivos dos sites de noticias getrdf("http://people.ubuntulinux.org/~mako/ubuntu-traffic/rss.rdf"); getrdf("http://www.ajaxian.com/index.rdf"); getrdf("http://www.redhat.com/magazine/rss20.xml"); getrdf("http://info.abril.com.br/aberto/infonews/rssnews.xml"); getrdf("http://feeds.feedburner.com/gnomeTUX"); getrdf("http://schneider.blogspot.com/rss/blogger_rss.xml"); getrdf("http://slashdot.org/slashdot.rdf"); getrdf("http://www.pythonware.com/daily/rss.xml"); getrdf("http://www.planetpython.org/rss20.xml"); getrdf("http://www.gnomedesktop.com/backend.php"); getrdf("http://www.kde.org/dotkdeorg.rdf"); getrdf("http://www.underlinux.com.br/backend.php"); getrdf("http://br-linux.org/linux/?q=node/feed"); getrdf("http://www.redbooks.ibm.com/rss/ondemand.xml"); getrdf("http://newsforge.com/newsforge.rdf"); getrdf("http://lwn.net/headlines/rss"); getrdf("http://www.linuxsecurity.com.br/backend.php"); getrdf("http://freecode.linuxsecurity.com.br/backend.php"); getrdf("http://rssficado.com.br/xml.php?jb.xml"); getrdf("http://rssficado.com.br/xml.php?terra-noticias.xml"); getrdf("http://www2.mtv.com.br/drops/rssify.php"); getrdf("http://planet.ubuntulinux.org/rss20.xml"); getrdf("http://planet.gnome.org/rss20.xml"); getrdf("http://www.linhadecodigo.com.br/rss/artigos_geral.xml"); getrdf("http://grid.weblogsinc.com/rss.xml"); getrdf("http://planet.vivaolinux.com.br/rss20.xml"); //mostra na tela showRSS(); mysql_close($con); fim(); ?>