<?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>Visualrinse &#124; Design and Development by Chad Udell &#187; Mashups</title>
	<atom:link href="http://visualrinse.com/category/mashups/feed/" rel="self" type="application/rss+xml" />
	<link>http://visualrinse.com</link>
	<description>Design, Development, Technology and My Life.</description>
	<lastBuildDate>Thu, 22 Sep 2011 23:21:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>How To: Build a Simple RSS Reader with JQuery</title>
		<link>http://visualrinse.com/2008/09/24/how-to-build-a-simple-rss-reader-with-jquery/</link>
		<comments>http://visualrinse.com/2008/09/24/how-to-build-a-simple-rss-reader-with-jquery/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 03:15:31 +0000</pubDate>
		<dc:creator>Chad</dc:creator>
				<category><![CDATA[Mashups]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://visualrinse.com/?p=417</guid>
		<description><![CDATA[This one&#8217;s from my Mashups class. The first project, was to build an RSS Reader. I&#8217;ve already posted a quick tutorial on how to build an RSS reader with Adobe Flex. Here&#8217;s a simple one that uses JQuery to get the feeds and then loop through them to output them to the browser window. Piece [...]]]></description>
			<content:encoded><![CDATA[<p>This one&#8217;s from <a href="http://visualrinse.com/2008/06/19/announcing-a-new-class-for-the-fall-semester-mm491-mashups-and-rias/">my Mashups class</a>. The first project, was to build an RSS Reader. I&#8217;ve already posted <a href="http://visualrinse.com/2008/09/14/how-to-make-a-simple-rss-reader-with-adobe-flex/">a quick tutorial on how to build an RSS reader with Adobe Flex</a>. Here&#8217;s a simple one that uses JQuery to get the feeds and then loop through them to output them to the browser window. Piece of cake for many of you, yes, but if you have never used anything but the DOM and plain ol&#8217; JavaScript, you may be scared by the whole AJAX fad on teh intarwebs these days. JQuery makes it super easy to look like a Javascript rockstar. I teach a lot of students that haven&#8217;t ever touched a library of code like JQuery before, so tutorials like this are pretty valuable to some readers..<br />
<span id="more-417"></span><br />
First, create an XHTML file.</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span style="color: #00bbdd;">        &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #000066;">xml:lang</span>=<span style="color: #ff0000;">&quot;en&quot;</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">&quot;en&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;head<span style="font-weight: bold; color: black;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;meta</span> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;content-type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
    <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>Untitled<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/head<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;body<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/body<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/html<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>Then, download my favorite JavaScript API, JQuery.</p>
<p>Link the JS file in by adding this tag in the head:</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;jquery-1.2.6.min.js&quot;</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/script<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>Once we have JQuery linked in, it&#8217;s time to write some HTML&#8230; I created a couple &lt;div&gt; elements to act as wrappers/containers for the page&#8217;s content. I used an &lt;img&gt; to put a nice graphic header in the page, then added some semantic XHTML elements, an &lt;h1&gt; for the text header, a &lt;form&gt; tag to hold a &lt;select&gt; menu populated with a few of my favorite Flash blogs as the &lt;option&gt; elements setting their URLs as the value attributes for those, and of course a &lt;label&gt; to let everyone know they should &#8220;Select a Feed&#8221; via that menu. After the tags are closed, I put one more div after the form to contain the feed results after they are retrieved. I add id attributes liberally throughout the tags, as I may need to style them or use them in my JQuery reader soon, *hint* *hint*. </p>
<p>If you&#8217;re following along, your code probably looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span>
<span style="color: #00bbdd;">        &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;html</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> <span style="color: #000066;">xml:lang</span>=<span style="color: #ff0000;">&quot;en&quot;</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">&quot;en&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;head<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;meta</span> <span style="color: #000066;">http-equiv</span>=<span style="color: #ff0000;">&quot;content-type&quot;</span> <span style="color: #000066;">content</span>=<span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;title<span style="font-weight: bold; color: black;">&gt;</span></span></span>RSS Reader<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/title<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;jquery-1.2.6.min.js&quot;</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/script<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/head<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;body<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;container&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;visualrinse.com&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://visualrinse.com/wp-content/themes/smooth-dirt-10/header_08v2.jpg&quot;</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">&quot;Visualrinse&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Visualrinse.com&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/a<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;ui&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;h1<span style="font-weight: bold; color: black;">&gt;</span></span></span>Flash Feed Reader<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/h1<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;form</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;selectParser&quot;</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;label<span style="font-weight: bold; color: black;">&gt;</span></span></span>Select a feed:<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/label<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;select</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;diffFeeds&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Select<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://feeds.feedburner.com/aralbalkan&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Aral Balkan<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://www.bit-101.com/blog/?feed=rss2&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Bit-101<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://feeds.feedburner.com/peterelst/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Peter Elst<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://www.gskinner.com/blog/index.xml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Grant Skinner<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://blog.andre-michelle.com/feed/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Andre Michelle<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://feeds.feedburner.com/flashmagazine/rss2&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Flash Magazine<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://casario.blogs.com/mmworld/rss.xml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Marco Casario<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://www.sephiroth.it/weblog/index.xml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Sephiroth<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://www.quasimondo.com/index.xml&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Quasimondo<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://feeds.feedburner.com/sebleedelisle&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>Seb Lee-Delisle<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;option</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://osflash.org/feed.php&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>OS Flash<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/option<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/select<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/form<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;feedContent&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
	<span style="color: #ddbb00;">&amp;nbsp;</span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/div<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/body<span style="font-weight: bold; color: black;">&gt;</span></span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/html<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></div></div>

<p>Cool&#8230; So, time to add the interactivity. We&#8217;re going to add a script tag to the head area and begin writing a Javascript function. I called mine &#8220;get_rss_feeds()&#8221;. The basic idea behind the function is to use the JQuery api&#8217;s &#8220;get()&#8221; function to grab the URL of the selected item from feedList (the name of our select menu, remember?), then run through each item in the RSS feed, putting those tasty XML elements from the feed like title, pubdate and description into HTML and popping them on the page. Between runs, we&#8217;ll need a way to clear out the div containing the content, so each time a new feed loads, the old content is removed.</p>
<p>So to do this, let&#8217;s put the following code in the Javascript block:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> get_rss_feed<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #009900; font-style: italic;">//clear the content in the div for the next feed.</span>
	$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#feedContent&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #009900; font-style: italic;">//use the JQuery get to grab the URL from the selected item, put the results in to an argument for parsing in the inline function called when the feed retrieval is complete</span>
	$.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#diffFeeds'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">val</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">//find each 'item' in the file and parse it</span>
		$<span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'item'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
			<span style="color: #009900; font-style: italic;">//name the current found item this for this particular loop run</span>
			<span style="color: #003366; font-weight: bold;">var</span> $item = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #009900; font-style: italic;">// grab the post title</span>
			<span style="color: #003366; font-weight: bold;">var</span> title = $item.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'title'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #009900; font-style: italic;">// grab the post's URL</span>
			<span style="color: #003366; font-weight: bold;">var</span> link = $item.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'link'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #009900; font-style: italic;">// next, the description</span>
			<span style="color: #003366; font-weight: bold;">var</span> description = $item.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'description'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #009900; font-style: italic;">//don't forget the pubdate</span>
			<span style="color: #003366; font-weight: bold;">var</span> pubDate = $item.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'pubDate'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #009900; font-style: italic;">// now create a var 'html' to store the markup we're using to output the feed to the browser window</span>
			<span style="color: #003366; font-weight: bold;">var</span> html = <span style="color: #3366CC;">&quot;&lt;div class=<span style="color: #000099; font-weight: bold;">\&quot;</span>entry<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;h2 class=<span style="color: #000099; font-weight: bold;">\&quot;</span>postTitle<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> + title + <span style="color: #3366CC;">&quot;&lt;<span style="color: #000099; font-weight: bold;">\/</span>h2&gt;&quot;</span>;
			html += <span style="color: #3366CC;">&quot;&lt;em class=<span style="color: #000099; font-weight: bold;">\&quot;</span>date<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> + pubDate + <span style="color: #3366CC;">&quot;&lt;/em&gt;&quot;</span>;
			html += <span style="color: #3366CC;">&quot;&lt;p class=<span style="color: #000099; font-weight: bold;">\&quot;</span>description<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> + description + <span style="color: #3366CC;">&quot;&lt;/p&gt;&quot;</span>;
			html += <span style="color: #3366CC;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> + link + <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> target=<span style="color: #000099; font-weight: bold;">\&quot;</span>_blank<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Read More &gt;&gt;&lt;<span style="color: #000099; font-weight: bold;">\/</span>a&gt;&lt;<span style="color: #000099; font-weight: bold;">\/</span>div&gt;&quot;</span>;
&nbsp;
			<span style="color: #009900; font-style: italic;">//put that feed content on the screen!</span>
			$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#feedContent'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span>html<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;  
		<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #66cc66;">&#125;</span>;</pre></div></div>

<p>Now, besure to add the get_rss_feed function call to the feedList&#8217;s onchange event and you are good to go. With a catch, of course. This will only work when accessed locally via the &#8220;file://&#8221; protocol. IN order to use this online, you&#8217;ll need to circumvent the browser security sandbox and use a middleware proxy to grab the XML and make it local. Here&#8217;s the PHP:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #808080; font-style: italic;">// PHP Proxy</span>
	<span style="color: #808080; font-style: italic;">// Loads a XML from any location. Used with Flash/Flex apps to bypass security restrictions</span>
	<span style="color: #808080; font-style: italic;">// Author: Paulo Fierro</span>
	<span style="color: #808080; font-style: italic;">// January 29, 2006</span>
	<span style="color: #808080; font-style: italic;">// usage: proxy.php?url=http://mysite.com/myxml.xml</span>
&nbsp;
	<span style="color: #0000ff;">$session</span> = curl_init<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'url'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; 	               <span style="color: #808080; font-style: italic;">// Open the Curl session</span>
	curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span>, CURLOPT_HEADER, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>; 	       <span style="color: #808080; font-style: italic;">// Don't return HTTP headers</span>
	curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span>, CURLOPT_RETURNTRANSFER, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;   <span style="color: #808080; font-style: italic;">// Do return the contents of the call</span>
	<span style="color: #0000ff;">$xml</span> = curl_exec<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span><span style="color: #66cc66;">&#41;</span>; 	                       <span style="color: #808080; font-style: italic;">// Make the call</span>
	<span style="color: #000066;">header</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Type: text/xml&quot;</span><span style="color: #66cc66;">&#41;</span>; 	               <span style="color: #808080; font-style: italic;">// Set the content type appropriately</span>
	<span style="color: #000066;">echo</span> <span style="color: #0000ff;">$xml</span>; 	      <span style="color: #808080; font-style: italic;">// Spit out the xml</span>
	curl_close<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// And close the session</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Slick, eh? To use it, simply prepend the proxy&#8217;s URL used in the $.get call, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript">$.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'proxy.php?url='</span>+$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#diffFeeds'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">val</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></pre></div></div>

<p>So, there you go. Add some CSS in there and it&#8217;s all stylish. You can the feed reader in effect <a href="http://visualrinse.com/bradley/mm491/reader.html" target="_blank">here</a>.</p>
<p>Hope you enjoyed this.</p>
]]></content:encoded>
			<wfw:commentRss>http://visualrinse.com/2008/09/24/how-to-build-a-simple-rss-reader-with-jquery/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>How To: Make a Simple RSS Reader with Adobe Flex</title>
		<link>http://visualrinse.com/2008/09/14/how-to-make-a-simple-rss-reader-with-adobe-flex/</link>
		<comments>http://visualrinse.com/2008/09/14/how-to-make-a-simple-rss-reader-with-adobe-flex/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 03:11:18 +0000</pubDate>
		<dc:creator>Chad</dc:creator>
				<category><![CDATA[Mashups]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://visualrinse.com/?p=410</guid>
		<description><![CDATA[A little over a year ago, I converted my then dormant domain, Mediadinosaur.com, into a gossip focused news aggregator (previously, it was a media/celeb focused community and blog). It now captures feeds from a number of high profile celebrity rags (Egostastic, TMZ, E!, WWTD, etc) and lets you get your fan fix in one centralized [...]]]></description>
			<content:encoded><![CDATA[<p>A little over a year ago, I converted my then dormant domain, <a href="http://mediadinosaur.com" target="_blank">Mediadinosaur.com</a>, into a gossip focused news aggregator (previously, it was a media/celeb focused community and blog). It now captures feeds from a number of high profile celebrity rags (<a href="http://egotastic.com" target="_blank">Egostastic</a>, <a href="http://www.tmz.com/" target="_blank">TMZ</a>, E!, <a href="http://wwtd.com" target="_blank">WWTD</a>, etc) and lets you get your fan fix in one centralized place. I built it in Flex to highlight the ease of use of the Framework and the power that the HTTPService and E4X gives you in getting and parsing XML. I&#8217;m using the site as an exercise for my Mashups and RIAs class as an introduction to developing with Flex and a easing into the concept of reading and using XML feeds and services for students that may have never used either of them. So let&#8217;s take a look at how this all comes together.<span id="more-410"></span></p>
<p>Here is the site today:</p>
<p><img class="alignnone size-full wp-image-411" title="md_home" src="http://visualrinse.com/wp-content/uploads/2008/09/md_home.jpg" alt="" width="500" height="270" /></p>
<p>In this post, we&#8217;ll look at the site and find out what makes it tick. Here&#8217;s a quick overview: The interface is simple, it consists of only a ComboBox, a DataGrid, a TextArea, a couple Labels/Text components and a LinkButton. All of these Controls are placed in an assortment of Layout controls to assist with the overall look and feel. I then create a HTTPService and a couple quick AS3 functions to populate the ComboBox and handle feed results. The initial feedlist comes from a list of RSS feeds in a custom written XML file (which I&#8217;ll share in this post, as well), this could also come from an online service like a custom Yahoo pipe or an OPML file if you really wanted to get fancy.</p>
<p>After the basic app is functioning, I import one of Scalenine&#8217;s beautiful and easy to use skins, and voil?†. A feed reader for local filesystem use is ready. This could be run as a SWF or compiled as an AIR app for desktop use. However, if you want to put it online, you&#8217;ll need to use a middleware script to serve as a crossdomain proxy loader (this example is going to use PHP). This is needed to get around Flash player&#8217;s security sandbox which prevents you from loading XML files from other domains that lack a crossdomain.xml file.</p>
<p>Let&#8217;s examine the basic MXML markup before adding any AS3 or style calls:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; backgroundGradientColors=&quot;[#0099CC, #2383ac]&quot;&gt;
	&lt;mx:HTTPService id=&quot;feedList&quot; url=&quot;data/feedURLs.xml&quot; /&gt;
	&lt;mx:HTTPService id=&quot;mdFeed&quot; showBusyCursor=&quot;true&quot; useProxy=&quot;false&quot; /&gt;
	&lt;mx:VBox width=&quot;100%&quot; height=&quot;100%&quot;&gt;
		&lt;mx:HBox width=&quot;90%&quot; height=&quot;40&quot;&gt;
			&lt;mx:Label text=&quot;Choose a Site:&quot;/&gt;
			&lt;mx:ComboBox id=&quot;siteCombo&quot; labelField=&quot;name&quot; /&gt;
		&lt;/mx:HBox&gt;
		&lt;mx:Text width=&quot;90%&quot; color=&quot;#000000&quot;
		       text=&quot;Drag the divider up and down to resize the panel.&quot;/&gt;
		&lt;mx:VDividedBox height=&quot;100%&quot; width=&quot;100%&quot;&gt;
			&lt;mx:DataGrid id=&quot;mdGrid&quot; labelField=&quot;Choose a Site&quot; height=&quot;60%&quot; width=&quot;100%&quot;&gt;
			&lt;mx:columns&gt;
				&lt;mx:DataGridColumn headerText=&quot;The Dirt&quot; dataField=&quot;title&quot; /&gt;
				&lt;mx:DataGridColumn headerText=&quot;The Date&quot; width=&quot;100&quot; dataField=&quot;pubDate&quot;/&gt;
			&lt;/mx:columns&gt;
			&lt;/mx:DataGrid&gt;
			&lt;mx:TextArea right=&quot;10&quot; top=&quot;234&quot; bottom=&quot;50&quot; left=&quot;10&quot; width=&quot;100%&quot; height=&quot;30%&quot;/&gt;
		&lt;/mx:VDividedBox&gt;
		&lt;mx:LinkButton label=&quot;Read the Full Post&quot; bottom=&quot;10&quot; left=&quot;10&quot; width=&quot;150&quot;/&gt;
	&lt;/mx:VBox&gt;
&lt;/mx:Application&gt;</pre></td></tr></table></div>

<p>So, in the markup above, we create the visual components mentioned in the paragraph that preceded the source code, and add two HTTPServices, one for the list of all the feeds we are aggregating, and the other for the actual RSS feed data that we will retrieve once the user chooses a feed they want to review. </p>
<p>Here is a glance of the interface in Flex&#8217;s IDE:</p>
<p><img class="alignnone size-full wp-image-412" title="md_ide" src="http://visualrinse.com/wp-content/uploads/2008/09/md_ide.jpg" alt="" width="500" height="284" /></p>
<p>In order to add the interactivity, we&#8217;ll need to supply a list of feeds for the reader to parse, right? Here is the list of sites and the URLs for their RSS feeds in XML:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;sites<span style="font-weight: bold; color: black;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;egotastic.com&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://egotastic.com/feeds/index.xml&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;wwtdd.com&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://www.wwtdd.com/?mode=atom&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;defamer&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://www.defamer.com/excerpts.xml&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;superficial&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://www.thesuperficial.com/index.xml&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;idontlikeyouinthatway&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://feeds.feedburner.com/Idontlikeyouinthatwaycom&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;people.com&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://www.people.com/people/web/rss&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;eonline.com&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://www.eonline.com/everywhere/rss/index.jsp&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;tmz.com&quot;</span>	<span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://www.tmz.com/rss.xml&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;usweekly.com&quot;</span> <span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://64.90.166.18/atom/feed&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;CelebSlam&quot;</span> <span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://www.celebslam.com/feed/&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
	<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;site</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;I Can Haz&quot;</span> <span style="color: #000066;">data</span>=<span style="color: #ff0000;">&quot;http://feeds.feedburner.com/ICanHasCheezburger?format=xml&quot;</span> <span style="font-weight: bold; color: black;">/&gt;</span></span>
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/sites<span style="font-weight: bold; color: black;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Now that we have the XML ready, we need to add the MXML to get the feed to the application tag (creationComplete=feedList.send());):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>2
</pre></td><td class="code"><pre>&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; creationComplete=&quot;feedList.send()&quot; backgroundGradientColors=&quot;[#0099CC, #2383ac]&quot;&gt;</pre></td></tr></table></div>

<p>Once we have the feedList retreived, we need to do something with it, right? Well, let&#8217;s add it to the comboBox, &#8220;siteCombo&#8221;. Here&#8217;s the AS to do it:</p>

<div class="wp_syntax"><div class="code"><pre>[Bindable]
private var sites:ArrayCollection = new ArrayCollection();
&nbsp;
private function siteListHandler(event:ResultEvent):void{
	sites = event.result.sites.site;
	var siteObj:Object = new Object();
	siteObj.name = &quot;Select&quot;
	siteObj.url = &quot;&quot;;
	sites.addItemAt(siteObj,0);
	siteCombo.selectedIndex = 0;
	//trace(event.result);
 }</pre></div></div>

<p>In that snippet, we created an arrayCollection to store the result. We then add the initial null &#8220;Select&#8221; option to the comboBox. We also need to add the databinding to the &#8220;sites&#8221; comboBox, so that it can be populated with the list of sites. Let&#8217;s do that now:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
</pre></td><td class="code"><pre>&lt;mx:ComboBox id=&quot;siteCombo&quot; dataProvider=&quot;{sites}&quot; labelField=&quot;name&quot; /&gt;</pre></td></tr></table></div>

<p>With the sites ComboBox binded (bound?) to the feedList, we need to add the function to handle the change event, so when the user selects a feed, the RSS feed is loaded. Here it is:</p>

<div class="wp_syntax"><div class="code"><pre>public function chooseSiteFeed(url:String, name:String):void{
myURL = url;
mdFeed.send();
}</pre></div></div>

<p>Now that the mdFeed is triggered, what do we do? Well, it would be a good idea to bind the mdFeed results to the datagrid, right? Then we can see all the posts in the feed:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>13
</pre></td><td class="code"><pre>&lt;mx:DataGrid id=&quot;mdGrid&quot; labelField=&quot;Choose a Site&quot; dataProvider=&quot;{mdFeed.lastResult.rss.channel.item}&quot; height=&quot;60%&quot; width=&quot;100%&quot;&gt;</pre></td></tr></table></div>

<p>Now that the datagrid is getting fed with the tasty RSS results, we need to let the user read the description and then click a link to see the full post, right?</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>19
20
21
22
</pre></td><td class="code"><pre>&lt;mx:TextArea right=&quot;10&quot; top=&quot;234&quot; bottom=&quot;50&quot; left=&quot;10&quot; width=&quot;100%&quot; height=&quot;30%&quot;/&gt;
		&lt;/mx:VDividedBox&gt;
		&lt;mx:LinkButton label=&quot;Read the Full Post&quot; bottom=&quot;10&quot; left=&quot;10&quot; width=&quot;150&quot;/&gt;
	&lt;/mx:VBox&gt;</pre></td></tr></table></div>

<p>That should work&#8230; If not, don&#8217;t worry, I&#8217;m supplying the full MXML source. But first, let&#8217;s make sure we can use this little RSS reader on your site. In order to do this, we need to leverage some serverside scripting in order to load the RSS feed via a proxy script. This will let your SWF file make a call to the script, then script handles the external URL call, returning the result as a local XML file for your flash file. Here is what the PHP looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #808080; font-style: italic;">// PHP Proxy</span>
	<span style="color: #808080; font-style: italic;">// Loads a XML from any location. Used with Flash/Flex apps to bypass security restrictions</span>
	<span style="color: #808080; font-style: italic;">// Author: Paulo Fierro</span>
	<span style="color: #808080; font-style: italic;">// January 29, 2006</span>
	<span style="color: #808080; font-style: italic;">// usage: proxy.php?url=http://mysite.com/myxml.xml</span>
&nbsp;
	<span style="color: #0000ff;">$session</span> = curl_init<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'url'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>; 	               <span style="color: #808080; font-style: italic;">// Open the Curl session</span>
	curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span>, CURLOPT_HEADER, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>; 	       <span style="color: #808080; font-style: italic;">// Don't return HTTP headers</span>
	curl_setopt<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span>, CURLOPT_RETURNTRANSFER, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;   <span style="color: #808080; font-style: italic;">// Do return the contents of the call</span>
	<span style="color: #0000ff;">$xml</span> = curl_exec<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span><span style="color: #66cc66;">&#41;</span>; 	                       <span style="color: #808080; font-style: italic;">// Make the call</span>
	<span style="color: #000066;">header</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Content-Type: text/xml&quot;</span><span style="color: #66cc66;">&#41;</span>; 	               <span style="color: #808080; font-style: italic;">// Set the content type appropriately</span>
	<span style="color: #000066;">echo</span> <span style="color: #0000ff;">$xml</span>; 	      <span style="color: #808080; font-style: italic;">// Spit out the xml</span>
	curl_close<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$session</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// And close the session</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>So, make yourself a proxyURL.php file with that content in it and save it. If you go back and modifiy the mdFeed function to use the proxy script, everything should be in order&#8230; Here, in totality, is the app:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
</pre></td><td class="code"><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;absolute&quot; creationComplete=&quot;feedList.send()&quot; backgroundGradientColors=&quot;[#0099CC, #2383ac]&quot;&gt;
	&lt;mx:Script&gt;
		import mx.collections.ArrayCollection;
		import mx.rpc.events.ResultEvent;
		import mx.effects.Resize;
&nbsp;
		[Bindable]
		private var sites:ArrayCollection = new ArrayCollection();
		[Bindable]
		public var myURL:String; 
&nbsp;
		private function siteListHandler(event:ResultEvent):void{
			sites = event.result.sites.site;
			var siteObj:Object = new Object();
			siteObj.name = &quot;Select&quot;
			siteObj.url = &quot;&quot;;
			sites.addItemAt(siteObj,0);
			siteCombo.selectedIndex = 0;
		 	//trace(event.result);
		 }
&nbsp;
		 public function chooseSiteFeed(url:String, name:String):void{
		 	myURL = &quot;proxyURL.php?url=&quot; + url;
       		mdFeed.send();
		 }
&nbsp;
	&lt;/mx:Script&gt;
	&lt;mx:Style source=&quot;css/OSX.css&quot; /&gt;
	&lt;mx:HTTPService id=&quot;feedList&quot; url=&quot;data/feedURLs.xml&quot; result=&quot;siteListHandler(event)&quot;/&gt;
	&lt;mx:HTTPService id=&quot;mdFeed&quot; url=&quot;{myURL}&quot; showBusyCursor=&quot;true&quot; useProxy=&quot;false&quot; /&gt;
	&lt;mx:VBox width=&quot;100%&quot; height=&quot;100%&quot;&gt;
		&lt;mx:HBox width=&quot;90%&quot; height=&quot;40&quot;&gt;
			&lt;mx:Label text=&quot;Choose a Site:&quot;/&gt;
			&lt;mx:ComboBox id=&quot;siteCombo&quot; dataProvider=&quot;{sites}&quot; labelField=&quot;name&quot; change=&quot;chooseSiteFeed(ComboBox(event.target).selectedItem.data, ComboBox(event.target).selectedItem.name)&quot; /&gt;
		&lt;/mx:HBox&gt;
		&lt;mx:Text width=&quot;90%&quot; color=&quot;#000000&quot;
		       text=&quot;Drag the divider up and down to resize the panel.&quot;/&gt;
		&lt;mx:VDividedBox height=&quot;100%&quot; width=&quot;100%&quot;&gt;
			&lt;mx:DataGrid id=&quot;mdGrid&quot; labelField=&quot;Choose a Site&quot; dataProvider=&quot;{mdFeed.lastResult.rss.channel.item}&quot; height=&quot;60%&quot; width=&quot;100%&quot;&gt;
			&lt;mx:columns&gt;
				&lt;mx:DataGridColumn headerText=&quot;The Dirt&quot; dataField=&quot;title&quot; /&gt;
				&lt;mx:DataGridColumn headerText=&quot;The Date&quot; width=&quot;100&quot; dataField=&quot;pubDate&quot;/&gt;
			&lt;/mx:columns&gt;
			&lt;/mx:DataGrid&gt;
			&lt;mx:TextArea htmlText=&quot;{mdGrid.selectedItem.description}&quot; right=&quot;10&quot; top=&quot;234&quot; bottom=&quot;50&quot; left=&quot;10&quot; width=&quot;100%&quot; height=&quot;30%&quot;/&gt;
		&lt;/mx:VDividedBox&gt;
		&lt;mx:LinkButton label=&quot;Read the Full Post&quot; click=&quot;navigateToURL(new URLRequest(mdGrid.selectedItem.link));&quot; bottom=&quot;10&quot; left=&quot;10&quot; width=&quot;150&quot;/&gt;
	&lt;/mx:VBox&gt;
&lt;/mx:Application&gt;</pre></td></tr></table></div>

<p>IN the code I also loaded the OSX skin from <a href="http://scalenine.com">Scalenine</a>. So there you have it. Pretty easy, really, though I understand I may not have explained it all as well as possible. It&#8217;s just easier when you are actually going through things in front of a lab or class. If you have questions on how it all works, feel free to drop me a line. You can download the source, <a href="/files/MD.zip">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://visualrinse.com/2008/09/14/how-to-make-a-simple-rss-reader-with-adobe-flex/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>An Oldie, But A Goodie&#8230; &#8220;What are Mashups?&#8221;</title>
		<link>http://visualrinse.com/2008/09/01/an-oldie-but-a-goodie-what-are-mashups/</link>
		<comments>http://visualrinse.com/2008/09/01/an-oldie-but-a-goodie-what-are-mashups/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 01:49:32 +0000</pubDate>
		<dc:creator>Chad</dc:creator>
				<category><![CDATA[Mashups]]></category>

		<guid isPermaLink="false">http://visualrinse.com/?p=402</guid>
		<description><![CDATA[A few months ago, I was interviewed by a local TV station for a tech interest segment on mashups. I spoke with Tim McGinnis, the reporter featured in this clip and really had a good time. It was a short piece, but I still really enjoyed getting my couple minutes on the tube. My wife&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I was interviewed by a local TV station for a tech interest segment on mashups. I spoke with Tim McGinnis, the reporter featured in this clip and really had a good time. It was a short piece, but I still really enjoyed getting my couple minutes on the tube. My wife&#8217;s grandfather, (now 90!), saw me and immediately called her. The call went something like this:</p>
<p><em><strong>Grandpa:</strong>&#8220;Chad&#8217;s on TV!&#8221;</em><br />
<em><strong>Renee:</strong>&#8220;Yeah, we just saw that. Pretty cool, huh?&#8221;</em><br />
<em><strong>Grandpa:</strong>&#8220;What the hell was he talking about?&#8221;</em><br />
<em><strong>Renee:</strong>&#8220;I have no idea, either.&#8221;</em></p>
<p><strong>I laughed.</strong></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/TNF1d6hmHPc&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/TNF1d6hmHPc&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://visualrinse.com/2008/09/01/an-oldie-but-a-goodie-what-are-mashups/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A Deep and Meaningful API, One to Definitely Try Out: GovTrack.Us</title>
		<link>http://visualrinse.com/2008/07/06/a-deep-and-meaningful-api-one-to-definitely-try-out-govtrackus/</link>
		<comments>http://visualrinse.com/2008/07/06/a-deep-and-meaningful-api-one-to-definitely-try-out-govtrackus/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 02:08:06 +0000</pubDate>
		<dc:creator>Chad</dc:creator>
				<category><![CDATA[Kuler]]></category>
		<category><![CDATA[Mashups]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://visualrinse.com/?p=377</guid>
		<description><![CDATA[About a week ago, I sent out a tweet asking for ideas on new APIs that might be worth checking out. You see, I am teaching a mashup course this fall and I need some new source material. I&#8217;ve played with Kuler, ColourLovers, Delicious, Yahoo Pipes, Technorati and a couple others (mostly unpublished and just [...]]]></description>
			<content:encoded><![CDATA[<p>About a week ago, I <a href="http://twitter.com/visualrinse/statuses/846576817" target="_blank">sent out a tweet</a> asking for ideas on new APIs that might be worth checking out. You see, <a href="http://visualrinse.com/2008/06/19/announcing-a-new-class-for-the-fall-semester-mm491-mashups-and-rias/" target="_blank">I am teaching a mashup course this fall</a> and I need some new source material. I&#8217;ve played with <a href="http://visualrinse.com/coolerkreator" target="_blank">Kuler</a>, <a href="http://visualrinse.com/dekafLovers" target="_blank">ColourLovers</a>, <a href="http://pipelicious.visualrinse.com" target="_blank">Delicious, Yahoo Pipes, Technorati</a> and a couple others (mostly unpublished and just experimental), but I just feel like I was missing something. I needed to check some other things out. Of course the new AS3 APIs for Google maps are out, so those are absolutely on my list, but I wanted some more &#8220;content rich&#8221; APIs. I spent some time on programmableweb.com (a great source for mashups and APIs) but only found a couple that struck my fancy enough to think about spending what is virtually my nonexistant free time on building a toy.</p>
<p><a href="http://rachelsodyssey.blogspot.com/" target="_blank">Rachael Rubin</a> (<a href="http://twitter.com/wildhoney" target="_blank">wildhoney</a> on twitter) was kind enough to point me to the newly revised <a href="http://www.last.fm/api" target="_blank">Last.FM API</a> and I think I will definitely use it at some point, but without a a proper link to the streaming music in their library, building a non playing audio based mashup seems a little less fun that it should be. It seems as though they intentionally make accessing the streams a little difficult to discourage bandwidth abuse.</p>
<p>All that changed today when I came across <a href="http://www.govtrack.us/" target="_blank">Govtrack.us</a> on programmableweb. Wow. What a useful API. Fun? Not really&#8230; it&#8217;s an interface to the mountains of data generated by our Congressional representatives day to day business. Deep stuff. With the ever growing need for governmental transparency in this somewhat crazy time, it&#8217;s a fantastic resource to have. Generate clean XML based on what your reps are voting on, meeting about and talking over. Combine this with Google maps or perhaps any number of other rich data sources and you have some amazing potential to bring visibility to a very opaque world. Providing a new or easier to use interface to the insurmountable volumes of legislation might uncover some realizations that may have gone unnoticed otherwise.</p>
<p>I&#8217;m definitely going to give this one a spin. Shall we find something out from all of this? It remains to be seen, I guess. I have a few ideas on things I might like to track&#8230; how about you?</p>
]]></content:encoded>
			<wfw:commentRss>http://visualrinse.com/2008/07/06/a-deep-and-meaningful-api-one-to-definitely-try-out-govtrackus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tried Wordle Yet? Generate Tag Cloud Art From Your Del.icio.us Bookmarks</title>
		<link>http://visualrinse.com/2008/06/30/tried-wordle-yet-generate-tag-cloud-art-from-your-delicious-bookmarks/</link>
		<comments>http://visualrinse.com/2008/06/30/tried-wordle-yet-generate-tag-cloud-art-from-your-delicious-bookmarks/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 15:20:08 +0000</pubDate>
		<dc:creator>Chad</dc:creator>
				<category><![CDATA[Mashups]]></category>

		<guid isPermaLink="false">http://visualrinse.com/?p=373</guid>
		<description><![CDATA[It&#8217;s no secret that I dig mashups. There is a particularly cool one that popped up recently called Wordle. It generates a word-art style tag cloud from a collection of text, an RSS feed or uses your Del.icio.us bookmarks tags. A very nice packing algorithm and some good color and typography customization options make the [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s no secret that I dig <a href="http://www.programmableweb.com/profile/visualrinse" target="_blank">mashups</a>. There is a particularly cool one that popped up recently called <a href="http://wordle.net" target="_blank">Wordle</a>. It generates a word-art style tag cloud from a collection of text, an RSS feed or uses your Del.icio.us bookmarks tags. A very nice packing algorithm and some good color and typography customization options make the end results pretty aesthetically pleasing. Using <a href="http://del.icio.us/mm465" target="_blank">my web design bookmarks</a> (used very often as a teaching resource for my students), produced this masterpiece:</p>
<p><img src="http://visualrinse.com/wp-content/uploads/2008/06/picture-1.png" alt="" width="500" /></p>
<p>You should go check the site out. A pretty good selection of creations is popping up over there. I&#8217;m not sure about the actual construction of the piece, but due to it being a Java Applet, I&#8217;m guessing it was built with <a href="http://processing.org" target="_blank">Processing</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://visualrinse.com/2008/06/30/tried-wordle-yet-generate-tag-cloud-art-from-your-delicious-bookmarks/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>DekafLovers Featured as Mashup of the Day at ProgrammableWeb.</title>
		<link>http://visualrinse.com/2008/05/07/dekaflovers-featured-as-mashup-of-the-day-at-programmableweb/</link>
		<comments>http://visualrinse.com/2008/05/07/dekaflovers-featured-as-mashup-of-the-day-at-programmableweb/#comments</comments>
		<pubDate>Wed, 07 May 2008 18:04:13 +0000</pubDate>
		<dc:creator>Chad</dc:creator>
				<category><![CDATA[Kuler]]></category>
		<category><![CDATA[Mashups]]></category>

		<guid isPermaLink="false">http://visualrinse.com/?p=335</guid>
		<description><![CDATA[Many thanks to Darius and everyone at ColourLovers for making a great, easy to use API, also thanks to Juan Sanchez and the Degrafa team for making Degrafa the best way to draw in Flex. The DekafLovers mashup is currently featured at programmableweb.com as the mashup of the day and they have a nice writeup [...]]]></description>
			<content:encoded><![CDATA[<p>Many thanks to Darius and everyone at <a href="http://colourlovers.com" target="_blank">ColourLovers</a> for making a great, easy to use API, also thanks to<a href="http://scalenine.com" target="_blank"> Juan Sanchez </a>and the Degrafa team for making <a href="http://degrafa.com" target="_blank">Degrafa</a> the best way to draw in Flex. The DekafLovers mashup is currently featured at <a href="http://programmableweb.com" target="_blank">programmableweb.com</a> as the mashup of the day and they have a nice writeup of it <a href="http://blog.programmableweb.com/2008/05/07/love-color-use-this-api/" target="_blank">here</a>. This mashup uses a similar codebase to Cooler Kreator, but uses the ColourLovers API instead of Kuler.</p>
<p>It&#8217;s great to get people making these patterns, I love seeing the stuff it produces.</p>
]]></content:encoded>
			<wfw:commentRss>http://visualrinse.com/2008/05/07/dekaflovers-featured-as-mashup-of-the-day-at-programmableweb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

