本文整理汇总了PHP中RSS::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP RSS::parse方法的具体用法?PHP RSS::parse怎么用?PHP RSS::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSS
的用法示例。
在下文中一共展示了RSS::parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Snoopy
}
if ($output == '') {
//cache is off OR have no cache OR it's STALE
//use system class Snoopy
//this class is used in manager panel to show news on startpage.
require_once $basePath . 'manager/media/rss/extlib/Snoopy.class.inc';
$client = new Snoopy();
$client->agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 GTB7.1';
$client->read_timeout = '10';
$client->use_gzip = true;
$datas = array();
foreach ($urls as $url) {
//that's it!
$client->fetch($url);
//parse xml
$data = RSS::parse($client->results, $url, $more);
//merge results
$datas = array_merge($datas, $data);
}
//sort results by date
usort($datas, 'RSS::date_sort');
//cut some items
$datas = array_splice($datas, 0, $num);
//parse template and collect results
$outputs = array();
foreach ($datas as $param) {
//translate rss date (Fri, 01 Apr 2011 14:13:08 +0400) to readable view
//need $dateFormat. If no $dateFormat - don't touch date
$param[date] = RSS::format_date($param[date], $dateFormat);
if ($tpl) {
//has chunk