예제 #1
0
$feed->set_stupidly_fast(true);
$feed->enable_order_by_date(true);
$feed->set_url_replacements(array());
$result = $feed->init();
//$feed->handle_content_type();
//$feed->get_title();
if ($result && (!is_array($feed->data) || count($feed->data) == 0)) {
	die('Sorry, no feed items found');
}

//////////////////////////////////////////
// Get feeds from OPML (if URL is not feed)
//////////////////////////////////////////
if (!$result) {
	$opml = new IAM_OPML_Parser();
	$feeds_array = $opml->getFeeds($url);
	if (!is_array($feeds_array) || count($feeds_array) == 0) {
		die('URL must point to a feed or OPML of feeds');
	}
	$feed_urls = array();
	foreach($feeds_array as $feed_item) {
		if (trim($feed_item['feeds']) != '') {
			$feed_urls[] = trim($feed_item['feeds']);
		}
		// limit to 10 URLs in OPML
		if (count($feed_urls) >= 10) break;
	}
	// setup SimplePie again
	if ($order == 'asc') {
		$feed = new SimplePie_Chronological();
	} else {
예제 #2
0
<?php

/** ensure this file is being included by a parent file */
defined( 'OOS_VALID_MOD' ) or die( 'Direct Access to this location is not allowed.' );

require_once('iam_opml_parser.php');

$opml_url = 'http://www.scripting.com/feeds/top100.opml';
$parser = new IAM_OPML_Parser();
$links = $parser->getFeeds($opml_url);

// Start List
print "<ul>";
foreach($links as $feed)
{
	$link = parse_url($feed['feeds'],PHP_URL_SCHEME).'://'.parse_url($feed['feeds'], PHP_URL_HOST);
	if(trim(parse_url($feed['feeds'], PHP_URL_HOST))!='')
		print "<li><a href=\"$link\">{$feed[names]}</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"{$feed[feeds]}\">RSS Feed</a></li>";
}
print "</ul>";