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 » get_feed_tags()

get_feed_tags()

Description

class SimplePie {
	get_feed_tags ( string $namespace, string $tag )
}

This method allows you to get access to ANY element/attribute that is a sub-element of the opening feed tag. It will return an array, which you should look at with PHP's print_r() function.

:!: Note that this will return an array of all of the elements it finds, and you can only go deeper – not shallower.

Availability

  • Available since SimplePie 1.0.

Parameters

namespace (required)

The URL of the XML namespace of the elements you're trying to access. SimplePie has a number of constants for supported namespaces in our Supported XML Namespaces document. If we don't have a constant for it, you can manually add the namespace URL as listed inside the feed.

tag (required)

This is the tag (element) that you want to get.

Examples

Grab the contents of a custom element

$feed = new SimplePie();
$feed->set_feed_url('http://video.google.com/videofeed?type=top100new&num=20&output=rss');
$feed->enable_cache(false);
$success = $feed->init();
$feed->handle_content_type('text/plain');
 
if ($success)
{
	// We're parsing an RSS 2.0 feed which doesn't have a namespace, so we pass in an empty string for the namespace.
	$channel = $feed->get_feed_tags('', 'channel');
	print_r($channel);
}
else
{
	echo $feed->error();
}

See Also


reference/simplepie/get_feed_tags.txt · Last modified: 2011/10/19 00:09 by rmccue