Php.net News
Dieses Script gibt $anzahl aktuelle News von der Homepage
php.net wieder
|
Script: |
<?php
$anzahl = 10;
$news =
"http://www.php.net/news.rss";
$content =
implode("",
file($news));
preg_match_all("/\<item
rdf:about=\"(.*?)\"\>(.*?)\<\/item\>/si",
$content, $results);
for($i=0;$i<$anzahl
&& $i<count($results[1]);$i++)
{
preg_match("/\<link\>(.*?)\<\/link\>/si",
$results[2][$i],
$link);
preg_match("/\<title\>(.*?)\<\/title\>/si",
$results[2][$i],
$title);
preg_match("/\<description\>(.*?)\<\/description\>/si",
$results[2][$i],
$description);
preg_match("/\<dc:date\>(.*?)\<\/dc:date\>/si",
$results[2][$i],
$date);
list($y,
$m, $d)
= explode("-",
$date[1]);
$date
= date("d.m.Y",
mktime(0,0,0,$m,$d,$y));
$link
= $link[1];
$title
= $title[1];
$description
= $description[1];
echo "<a
href=\"".$link."\"
target=\"_blank\">[".$date."]
".$title."</a><br
/>".$description."<br
/><br />";
}
?>
|
|