这篇文章主要介绍了php解析rss的方法,实例分析了php解析rss的原理与xml文件的操作技巧,需要的朋友可以参考下
本文实例讲述了PHP解析RSS的方法。分享给大家供大家参考。具体如下:
php代码如下: 代码如下:
parse();
foreach($rss->getItems() as $item) {
print_r($item);
}
?>
2. RSS.php代码如下:
代码如下:
Our Demo RSS
http://www.php.cn/;/link>
A Test RSS
en-us
$now
$now
http://www.php.cn/;/docs>
you@youremail.com
you@youremail.com
";
foreach ($return as $line)
{
$output .= "".htmlentities($line['headline'])."
".htmlentities($line['link'])."
".htmlentities(strip_tags($line['description']))."
";
}
$output .= " ";
header("Content-Type: application/rss+xml");
echo $output;
?>











