سلام
از این کد میتونید استفاده کنید
البته من برای 5 خبر آخر لیمیت کردم که میتونید تغییر بدین
کد:
<?php $rss = new DOMDocument();
$rss->load('http://roudanhost.ir/client/announcementsrss.php');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$count=count($feed);
if($count<5)
{
$limit=$count;
}
else
{
$limit=5;
}
if($count!=0)
{
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
echo '<li><a href="'.$link.'" title="'.$title.'" target="_blank">'.$title.'</a></li>';
}
}
?>