<?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>Half-Baked Bits&#187; Projects</title>
	<atom:link href="http://halfbakedbits.com/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://halfbakedbits.com</link>
	<description>Small Ideas Factory</description>
	<lastBuildDate>Fri, 09 Jan 2009 12:43:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Retrieving Delicious (Del.icio.us) Feed with PHP &amp; CURL</title>
		<link>http://halfbakedbits.com/2008/10/retrieving-delicious-delicious-feed-via-php-curl/</link>
		<comments>http://halfbakedbits.com/2008/10/retrieving-delicious-delicious-feed-via-php-curl/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 02:00:56 +0000</pubDate>
		<dc:creator>Brett Veenstra</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[deliciousrssimporter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sourceforge]]></category>

		<guid isPermaLink="false">http://halfbakedbits.com/?p=157</guid>
		<description><![CDATA[Looking back on the progress since my last post about the Delicious RSS Importer (DRI) project, these past two weeks have seen only a small functional improvement. Alas, the journey of an Open Source Project. PHP is rather new to me, but I was comfortable with the interpretive style with my experiences in Classic ASP, [...]]]></description>
			<content:encoded><![CDATA[<p>Looking back on the progress since my last post about the Delicious RSS Importer (DRI) project, these past two weeks have seen only a small functional improvement.  Alas, the journey of an <a href="http://sourceforge.net/projects/deliciousrssimp">Open Source Project</a>.</p>

<p>PHP is rather new to me, but I was comfortable with the interpretive style with my experiences in Classic ASP, and PHP&#8217;s C-like syntax.  I figured I could whip something out in a few minutes (maybe an hour once I saw what we could do) that would retrieve my Delicious feed using their <a href="http://delicious.com/help/api">API</a>.</p>

<p>&#8220;Wait a minute!&#8221; you say, &#8220;Doesn&#8217;t Delicious already provide a way to find this information using JSON and this would then allow you to use <a href="http://www.google.com/search?q=jquery+json+remote+retrieval">JQuery to do a Remote Data call?</a>&#8221;  Ah yes, but only for <em>public</em> bookmarks.  We&#8217;re trying to support all Delicious bookmarks here.</p>

<p>So let&#8217;s get back to the bane of PHP development: trying to find relevant, <strong>correct</strong> examples.  Not only did I need to <a href="http://www.google.com/search?q=retrieve+data+using+Curl">retrieve data using Curl</a>, but I also needed to provide a <a href="http://www.google.com/search?hl=en&amp;q=retrieve+data+Curl+username+password">Username and Password</a>, over <a href="http://www.google.com/search?hl=en&amp;q=retrieve+data+Curl+SSL+username+password">SSL</a>.  It felt like going from 0 to <a href="http://www.google.com/search?q=convert+100mph+to+kph">100mph</a> and I forgot to <a href="http://www.google.com/search?hl=en&amp;q=php+getting+started">cover the basics</a> first.  But, I&#8217;m a &#8220;seasoned&#8221; developer, I can handle it.</p>

<p>A few <strong>hours</strong> later and I had code, that wouldn&#8217;t run.  I was relegated to reading&#8230;<a href="http://oreilly.com/catalog/9780596514013/">a book</a>.  A little time with <a href="http://w3schools.com/php/default.asp">w3schools PHP section</a> would have answered most of my questions, correctly.</p>

<p>These were the two things that made the progress slow:</p>

<ul>
<li>Finding the correct way to concatenate strings in PHP &#8211; &#8220;.&#8221;</li>
<li>Finding the correct way to retrieve variables from &#8220;$_REQUEST&#8221; object</li>
</ul>

<p>Enough already, let&#8217;s have the code!</p>

<pre><code><?php

    if( !extension_loaded('curl') ){
            die('You need to load/activate the cURL extension (http://www.php.net/cURL).');
    }
    
    $fetch_url = "https://api.del.icio.us/v1/posts/all?";       //for production
    $fetch_url = "https://api.del.icio.us/v1/posts/recent?count=3";

    $user = $_REQUEST["user"];
    $pwd = $_REQUEST["pwd"];

    $curl = curl_init();
    curl_setopt( $curl, CURLOPT_URL, $fetch_url );
    curl_setopt( $curl, CURLOPT_FAILONERROR, 1); 
    curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, 1);     // allow redirects 
    curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );    // return into a variable 
    curl_setopt( $curl, CURLOPT_HEADER, 0 );        // do not put Header info into result
    curl_setopt( $curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt( $curl, CURLOPT_USERPWD, $user . ":" . $pwd );
    curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, 1 );
    curl_setopt( $curl, CURLOPT_TIMEOUT, 120 );
    // curl_setopt( $curl, CURLOPT_USERAGENT, "delicious-rss-importer" );
    $content = curl_exec( $curl );

//Debug
/*
    print_r(curl_getinfo($curl)); 
    echo "\n\ncURL error number:" .curl_errno($curl); 
    echo "\n\ncURL error:" . curl_error($curl); 
*/


    curl_close( $curl );

    header("Content-Type:text/xml");
    print $content;

?>

</code></pre>

<p><strong>Note:</strong> As <a href="http://halfbakedbits.com/author/nathan/">Nathan</a> has pointed out already, you don&#8217;t have to use &#8220;$user&#8221; or &#8220;$pwd&#8221; as they will be automatically populated via PHP.  I choose to include them to highlight intent<del datetime="2008-10-10T10:30:39+00:00">didn&#8217;t know PHP did that at first</del>.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfbakedbits.com/2008/10/retrieving-delicious-delicious-feed-via-php-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big Design Upfront: Delicious RSS Importer</title>
		<link>http://halfbakedbits.com/2008/09/big-design-upfront-delicious-rss-importer/</link>
		<comments>http://halfbakedbits.com/2008/09/big-design-upfront-delicious-rss-importer/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 05:00:44 +0000</pubDate>
		<dc:creator>Brett Veenstra</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[delicious]]></category>
		<category><![CDATA[deliciousrssimporter]]></category>
		<category><![CDATA[google gears]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[sourceforge]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://halfbakedbits.com/?p=144</guid>
		<description><![CDATA[In my last post, I introduced the mockups of a half-baked idea: Delicious RSS Importer. I was trying to explain the idea this past week and quickly realized that I need to put together some visuals to how this will work. I&#8217;m not backsliding into an old habit of BDUF. I&#8217;ll keep this brief and [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post, I introduced the mockups of a half-baked idea: <a href="http://halfbakedbits.com/2008/09/half-baked-idea-delicious-rss-importer/">Delicious RSS Importer</a>.  I was trying to explain the idea this past week and quickly realized that I need to put together some visuals to how this will work.</p>

<p>I&#8217;m not backsliding into an old habit of <a href="http://c2.com/xp/BigDesignUpFront.html">BDUF</a>.  I&#8217;ll keep this brief and use this latest post to simply work out the plan of how the major pieces fit.</p>

<p>Here&#8217;s the current intent:
<div id="attachment_148" class="wp-caption alignnone" style="width: 542px"><a href="http://halfbakedbits.com/wp-content/uploads/2008/09/delicious-rss-importer-architecture.png"><img src="http://halfbakedbits.com/wp-content/uploads/2008/09/delicious-rss-importer-architecture.png" alt="Delicious RSS Importer Architecture" title="delicious-rss-importer-architecture" width="532" height="600" class="size-medium wp-image-148" /></a><p class="wp-caption-text">Delicious RSS Importer Architecture</p></div></p>

<p>Basically we need to have a server-side piece to proxy the data requests from Delicious and external RSS feeds.  Those results are then stored client-side using <a href="http://gears.google.com/">Google Gears</a>.</p>

<p>The other concern is that NO passwords are stored externally.  Once you setup Delicious RSS Importer for your environment, your credentials remain private.</p>

<p>Finally, I managed to setup a <a href="http://sourceforge.net/projects/deliciousrssimp">dedicated project space</a> for this work with the good folks at SourceForge.</p>
]]></content:encoded>
			<wfw:commentRss>http://halfbakedbits.com/2008/09/big-design-upfront-delicious-rss-importer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
