<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>New Fish&#187; PHP</title>
	<atom:link href="http://fairyfish.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://fairyfish.com</link>
	<description>I only sell WordPress Themes!</description>
	<lastBuildDate>Fri, 09 Oct 2009 08:56:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MagpieRSS</title>
		<link>http://fairyfish.com/2008/05/03/magpierss/</link>
		<comments>http://fairyfish.com/2008/05/03/magpierss/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 16:04:29 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[MagpieRSS]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://fairyfish.com/2008/05/03/magpierss/</guid>
		<description><![CDATA[MagpieRSS provides an XML-based (expat) RSS parser in PHP. MagpieRSS is compatible with RSS 0.9 through RSS 1.0.  MagpieRSS can also parse RSS 1.0&#8217;s modules, RSS 2.0, and Atom. (with a few exceptions). In other words, it is the Swiss army knife of RSS parsers.
WordPress have already integrated the MagpieRSS PHP class into its [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://magpierss.sourceforge.net/">MagpieRSS</a> provides an XML-based (expat) RSS parser in PHP. MagpieRSS is compatible with RSS 0.9 through RSS 1.0.  MagpieRSS can also parse RSS 1.0&#8217;s modules, RSS 2.0, and Atom. (with a few exceptions). In other words, it is the Swiss army knife of RSS parsers.</p>
<p>WordPress have already integrated the MagpieRSS PHP class into its code, so it&#8217;s super easy to use MagpieRSS in WordPress.</p>
<pre>
<span style="color: Blue">&lt;?php</span><span style="color: Gray"> </span>

<span style="color: Green">include_once</span><span style="color: Olive">(</span><span style="color: Blue">ABSPATH</span><span style="color: Gray"> . </span><span style="color: Blue">WPINC</span><span style="color: Gray"> . </span><span style="color: #8b0000">'</span><span style="color: Red">/rss.php</span><span style="color: #8b0000">'</span><span style="color: Olive">)</span><span style="color: Gray">; </span>

<span style="color: #00008b">$rss</span><span style="color: Gray"> = </span><span style="color: Blue">fetch_rss</span><span style="color: Olive">(</span><span style="color: #8b0000">'</span><span style="color: Red">http://feed.fairyfish.net/</span><span style="color: #8b0000">'</span><span style="color: Olive">)</span><span style="color: Gray">; </span><span style="color: #00008b">$maxitems</span><span style="color: Gray"> = </span><span style="color: Maroon">5</span>

<span style="color: #00008b">$items</span><span style="color: Gray"> = </span><span style="color: Blue">array_slice</span><span style="color: Olive">(</span><span style="color: #00008b">$rss</span><span style="color: Gray">-&gt;</span><span style="color: Blue">items</span><span style="color: Gray">, </span><span style="color: Maroon">0</span><span style="color: Gray">, </span><span style="color: #00008b">$maxitems</span><span style="color: Olive">)</span>

<span style="color: Blue">?&gt;</span></pre>
<p>The code above will fetch the first 5 items of the feed ( <code>http://feed.fairyfish.net/</code>), and then store it in an array <code>items</code>. To see the detail of the array just use the PHP function <code>print_r</code> to print it.</p>
<p>You can use another function <code>wp_rss</code> in WordPress to retrieves an RSS feed and then parses it. It will then display it as an unordered list of links.</p>
<pre>
<span style="color: Blue">&lt;?php</span>

<span style="color: Green">include_once</span><span style="color: Olive">(</span><span style="color: Blue">ABSPATH</span><span style="color: Gray"> . </span><span style="color: Blue">WPINC</span><span style="color: Gray"> . </span><span style="color: #8b0000">'</span><span style="color: Red">/rss-functions.php</span><span style="color: #8b0000">'</span><span style="color: Olive">)</span>

<span style="color: Blue">wp_rss</span><span style="color: Olive">(</span><span style="color: #8b0000">'</span><span style="color: Red">http://feed.fairyfish.net/</span><span style="color: #8b0000">'</span><span style="color: Gray">, </span><span style="color: Maroon">5</span><span style="color: Olive">)</span>

<span style="color: Blue">?&gt;</span></pre>
<p>The function have two parameters, the first one is the feed you want to parse and the second one is used to set how many items you want to output.</p>
<p  class="related_post_title">Related Posts</p><ul class="related_post"><li><a href="http://fairyfish.com/2008/06/26/aiderss-wordpress-plugin-02/" title="AideRSS WordPress Plugin 0.2">AideRSS WordPress Plugin 0.2</a></li><li><a href="http://fairyfish.com/2008/05/26/aiderss-wordpress-plugin/" title="AideRSS WordPress Plugin">AideRSS WordPress Plugin</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://fairyfish.com/2008/05/03/magpierss/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
