Новини от даден сайт (РСС)

MontefuckeR

Registered
дайте код с който може да ползвам новините от даден сайт с РСС
и този код да е в моя сайт и като ъпдейтват сайта за новини и при мен да се ъпдейтва!
 
Примерно:

<?php
$xmlfile = fopen("http://rss.news.yahoo.com/rss/oddlyenough", "r");
if(!$xmlfile)die("cannot open the xml file");
$readfile = fread($xmlfile ,40000);
$searchfile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
echo "<table border='1'>";
echo "<th colspan='3'>latest news</th>";
for($i=1 ; $i<=$count-1 ;$i++)
{
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
ereg("<description>(.*)</description",$filechunks[$i],$desc);
echo "<tr><td>";
echo $title[1];
echo "</td><td>";
echo "<a href ='$links[1]'>$links[1]</a>";
echo "</td><td>";
echo $desc[1];
echo "</td></tr>";
}
echo "</table>";
?>


:wink:
 
<?php
$xmlfile = fopen("Линк към xml файла", "r");
if(!$xmlfile)die("cannot open the xml file");
$readfile = fread($xmlfile ,40000);
$searchfile = eregi("<item>(.*)</item>", $readfile ,$arrayreg);
$filechunks = explode("<item>", $arrayreg[0]);
$count = count($filechunks);
echo "<table border='1'>";
echo "<th colspan='3'>latest news</th>";
for($i=1 ; $i<=$count-1 ;$i++)
{
ereg("<title>(.*)</title>",$filechunks[$i], $title);
ereg("<link>(.*)</link>",$filechunks[$i], $links);
ereg("<description>(.*)</description",$filechunks[$i],$desc);
echo "<tr><td>";
echo $title[1];
echo "</td><td>";
echo "<a href ='$links[1]'>$links[1]</a>";
echo "</td><td>";
echo $desc[1];
echo "</td></tr>";
}
echo "</table>";
?>
 
http://www.dnes.bg/rss.php?top - Dnes.bg:Топ новини
http://www.dnes.bg/rss.php?special - Dnes.bg:Специално
http://www.dnes.bg/rss.php?most - Dnes.bg:Най-четени
http://www.dnes.bg/rss.php?last - Dnes.bg:Последни
 
виж как изглежда http://monmon8.freehostia.com/asdd.php
няма ли някой сайт с повече актоални новини да не са 4-5.. ?
ии ако може да го изкараме някакси само текста без сайта..и малко по-добър вид на таблицата :roll:
 
виж това: http://www.hotscripts.com/PHP/Scripts_and_Programs/XML_and_PHP/

http://www.feedforall.com/free-php-script.htm

http://4wordsystems.com/php-rss.php

http://www.google.bg/search?sourceid=navclient&ie=UTF-8&rlz=1T4GGLJ_enBG208__208&q=rss+feed+php+scripts

Утре ако намеря нещо по-така ще постна кода :wink:
 
трябват ми новини "у нас (какво ново в държавата)" не хардуерни или софтуерни новини на принципа на "БТВ-новините" ?!
 

Back
Горе