SimplePie 1.5 is now available!

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

You are here: Documentation » SimplePie Live! » API Reference » SimplePie

SimplePie

Description

Creates a new SimplePie object, optionally setting various settings (see their specific pages for more detail).

:!: If you're merging multiple feeds together, they need to all have dates for the items or else PHP will sort them to the top.

Parameters

feedUrl

Set the feed URL(s) that you want to use. Can either be a single String URL, or an Array of URLs.

options

This is a JSON-formatted object that should contain configuration options and callback handlers.

Returns

Returns a handle for the SimplePie object.

Examples

Assuming you've already included the base.js file as noted in Requirements and Getting Started

<script type="application/javascript">
 
var feed = new SimplePie('http://feeds.feedburner.com/simplepie', {
 
	// Set some configuration options.
	enableOrderByDate: false,
	setTimeout: 30,
 
	// Handle a successful response.
	onSuccess: function(feed) {
 
		// Do something simple for this example code.
		if (feed.title) {
			window.alert(feed.title);
		}
	},
 
	// Handle a failed response.
	onFailure: function(feed) {
 
		// The error message is always in the error property.
		window.alert(feed.error);
	}
});
 
</script>

live/reference/simplepie.txt · Last modified: 2011/03/06 03:56 (external edit)