Weigh-in with your opinion! Let us know what you think. Goals for SimplePie 2.

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » set_feed_url()

set_feed_url()

Description

class SimplePie {
	set_feed_url ( mixed $feed_url )
}

This sets the URL (or an array of URLs) that you want to parse. If there is not a feed at this location, auto-discovery is used unless it is disabled.

:!: There are differences between handling a single feed and merging feeds together with Multifeeds. Read Typical Multifeed Gotchas for notes on common issues.

Availability

  • Available since SimplePie 1.0.
  • Previously existed as feed_url() since SimplePie Preview Release.

Parameters

feed_url (required)

Set the feed URL(s).

Examples

Set the feed URL to the SimplePie blog

$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
$feed->init();
$feed->handle_content_type();
echo $feed->get_title();

Merge multiple feeds with the same config settings

$feed = new SimplePie();
$feed->set_feed_url(array(
	'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml',
	'http://rss.news.yahoo.com/rss/topstories',
	'http://news.google.com/?output=atom',
	'http://rss.slashdot.org/Slashdot/slashdot',
	'http://rss.cnn.com/rss/cnn_topstories.rss',
	'http://www.newsvine.com/_feeds/rss2/index'
));
$feed->init();
$feed->handle_content_type();
echo $feed->get_title();

There is also an alternate syntax discussed in SimplePie.

See Also


reference/simplepie/set_feed_url.txt · Last modified: 2008/02/28 15:53 by admin