SimplePie 1.3.1 is now available. Upgrade now!

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

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

force_feed()

Description

class SimplePie {
	force_feed ( [bool $enable = false] )
}

RSS and Atom feeds are supposed to have certain mime types associated with them so that software knows what type of data it is. Some feeds don't follow these rules, and serve feeds with invalid mime types (e.g. text/plain). SimplePie follows best practices by default, but you can override this behavior with this option.

Availability

  • Available since SimplePie 1.1.

Parameters

enable

Enable/disable forcing the data to be handled as a feed.

Examples

Force SimplePie to handle a text/plain document as a feed

$feed = new SimplePie();
$feed->set_feed_url('http://youtube.com/rss/global/recently_added.rss');
$feed->force_feed(true);
$feed->init();
$feed->handle_content_type();
echo $feed->get_title();

:!: Note: Whereas YouTube feeds used to be served as text/plain, we notified them of the issue and they have since changed the mime type to application/rss+xml.

See Also


reference/simplepie/force_feed.txt · Last modified: 2011/03/05 19:56 (external edit)