Home >php教程 >php手册 >PHP读取RSS feed源的代码(带注释,可读取多个源)

PHP读取RSS feed源的代码(带注释,可读取多个源)

WBOY
WBOYOriginal
2016-06-21 08:57:01934browse

因为网站需要读取不同来源的rss feed,写了一个php程序来循环读取rss feed,为了方便阅读及了解程序实现过程,加上了注释,和大家共同学习。而助易网的rss读取就是在这个程序的基础上稍做改造而成,主要是输出了一个数组字符串以及解决编码问题。

php源代码及代码详细解释如下:

".$title."
";              $is_item = 0;          }          //仅读取item标签中的内容          if($is_item==1){              if ($tag == "title") {$title = $value;}                      if ($tag == "link") {$link = $value;}          }      }      //输出结果      echo $rss_str."
";  }  ?>
 



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn