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 » API Reference » SimplePie » get_type()

get_type()

Description

class SimplePie {
	get_type ()
}

Returns the type of the feed. The type can be tested against using bitwise operators. There are a number of constants available for matching types:

  • SIMPLEPIE_TYPE_NONE
    Type is unknown.
  • SIMPLEPIE_TYPE_RSS_090
    Type is RSS 0.90.
  • SIMPLEPIE_TYPE_RSS_091_NETSCAPE
    Type is RSS 0.91 (Netscape).
  • SIMPLEPIE_TYPE_RSS_091_USERLAND
    Type is RSS 0.91 (Userland).
  • SIMPLEPIE_TYPE_RSS_091
    Type is RSS 0.91.
  • SIMPLEPIE_TYPE_RSS_092
    Type is RSS 0.92.
  • SIMPLEPIE_TYPE_RSS_093
    Type is RSS 0.93.
  • SIMPLEPIE_TYPE_RSS_094
    Type is RSS 0.94.
  • SIMPLEPIE_TYPE_RSS_10
    Type is RSS 1.0.
  • SIMPLEPIE_TYPE_RSS_20
    Type is RSS 2.0.x.
  • SIMPLEPIE_TYPE_RSS_RDF
    Type is RDF-based RSS.
  • SIMPLEPIE_TYPE_RSS_SYNDICATION
    Type is Non-RDF-based RSS (truly intended as syndication format).
  • SIMPLEPIE_TYPE_RSS_ALL
    Type is any version of RSS.
  • SIMPLEPIE_TYPE_ATOM_03
    Type is Atom 0.3.
  • SIMPLEPIE_TYPE_ATOM_10
    Type is Atom 1.0.
  • SIMPLEPIE_TYPE_ATOM_ALL
    Type is any version of Atom.
  • SIMPLEPIE_TYPE_ALL
    Type is any known/supported feed type.

Availability

  • Available since SimplePie 0.8.
  • Usage changed drastically in SimplePie 1.0. Constants are only available in SimplePie 1.0.

Examples

$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
$feed->init();
$feed->handle_content_type();
 
echo 'Feed type is ';
 
if ($feed->get_type() & SIMPLEPIE_TYPE_NONE)
{
	echo 'Unknown';
}
elseif ($feed->get_type() & SIMPLEPIE_TYPE_RSS_ALL)
{
	echo 'RSS';
}
elseif ($feed->get_type() & SIMPLEPIE_TYPE_ATOM_ALL)
{
	echo 'Atom';
}
elseif ($feed->get_type() & SIMPLEPIE_TYPE_ALL)
{
	echo 'Supported';
}

See Also


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