<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>DigInit :: digital initiatives &#187; php</title>
	<atom:link href="http://diginit.wordpress.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://diginit.wordpress.com</link>
	<description>building the digital commons for libraries</description>
	<lastBuildDate>Fri, 13 Nov 2009 15:18:05 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='diginit.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e4beb2286778f11feb7338d9f2b0f5af?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>DigInit :: digital initiatives &#187; php</title>
		<link>http://diginit.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://diginit.wordpress.com/osd.xml" title="DigInit :: digital initiatives" />
		<item>
		<title>Blip.tv API and YouTube API Code Samples &#8211; Library Mashups</title>
		<link>http://diginit.wordpress.com/2009/09/08/blip-tv-api-and-youtube-api-code-samples-library-mashups/</link>
		<comments>http://diginit.wordpress.com/2009/09/08/blip-tv-api-and-youtube-api-code-samples-library-mashups/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 23:09:58 +0000</pubDate>
		<dc:creator>Jason A. Clark</dc:creator>
				<category><![CDATA[code/files]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[blip.tv]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://diginit.wordpress.com/?p=85</guid>
		<description><![CDATA[My chapter &#8220;Blip.tv and Digital Video Collections in the Library&#8221; for the recently released Library Mashups edited by Nicole Engard was in need of some code samples. I wanted to show how to use the APIs I kept mentioning in the writing which focused on the digital library mashup of TERRApod. So&#8230; here they are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diginit.wordpress.com&blog=32913&post=85&subd=diginit&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>My chapter &#8220;<strong><a href="http://mashups.web2learning.net/toc/chapter-15">Blip.tv and Digital Video Collections in the Library</a></strong>&#8221; for the recently released <em><a href="http://mashups.web2learning.net/">Library Mashups</a> </em>edited by <a href="http://www.web2learning.net/">Nicole Engard</a> was in need of some code samples. I wanted to show how to use the APIs I kept mentioning in the writing which focused on the digital library mashup of <a href="http://www.terrapodcast.com">TERRApod</a>. So&#8230; here they are in their basic, rudimentary glory.</p>
<ul>
<li>blip.tv API demo &#8211; <a href="http://www.lib.montana.edu/~jason/files/api/bliptv/">http://www.lib.montana.edu/~jason/files/api/bliptv/</a></li>
<li>blip.tv API code &#8211; <a href="http://www.lib.montana.edu/~jason/files/api/bliptv/index.phps">http://www.lib.montana.edu/~jason/files/api/bliptv/index.phps</a></li>
</ul>
<ul>
<li>YouTube API demo &#8211; <a href="http://www.lib.montana.edu/~jason/files/api/youtube/">http://www.lib.montana.edu/~jason/files/api/youtube/</a></li>
<li>YouTube API code &#8211; <a href="http://www.lib.montana.edu/~jason/files/api/youtube/index.phps">http://www.lib.montana.edu/~jason/files/api/youtube/index.phps</a></li>
</ul>
<p>The complete code is available for download from <a href="http://www.lib.montana.edu/~jason/files.php">my code archive</a>. Think of these examples as the raw materials for building mashups with the blip.tv API and YouTube API. The blip.tv example relies on PHP 5, but I made the YouTube PHP4 compatible and you could adapt the code from there for the blip.tv API. I also included some CURL code in the comments of the files just in case your host requires it. If you have questions or improvements, drop a comment.</p>
<p>A quick word about the book: If you are at all interested in mashups and web services, take a closer look. The book covers one profession&#8217;s (the librarian) application of web services to library data problems. Contributions from industry leader&#8217;s like <a href="http://www.blyberg.net/">John Blyberg</a>, <a href="http://dilettantes.code4lib.org/">Ross Singer</a> and <a href="http://www.librarywebchic.net/">Karen Coombs</a> make this an interesting read for anyone interested in how web services and open data are changing the nature of web development for libraries.</p>
<p>&lt;end bookplug /&gt;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diginit.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diginit.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diginit.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diginit.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diginit.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diginit.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diginit.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diginit.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diginit.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diginit.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diginit.wordpress.com&blog=32913&post=85&subd=diginit&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://diginit.wordpress.com/2009/09/08/blip-tv-api-and-youtube-api-code-samples-library-mashups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e9c3e8cd1eecfd6a197f17ede70b82a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">diginit</media:title>
		</media:content>
	</item>
		<item>
		<title>Anatomy of a Function</title>
		<link>http://diginit.wordpress.com/2006/11/30/anatomy-of-a-function/</link>
		<comments>http://diginit.wordpress.com/2006/11/30/anatomy-of-a-function/#comments</comments>
		<pubDate>Thu, 30 Nov 2006 07:02:11 +0000</pubDate>
		<dc:creator>Jason A. Clark</dc:creator>
				<category><![CDATA[code/files]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://diginit.wordpress.com/2006/11/30/anatomy-of-a-function/</guid>
		<description><![CDATA[It&#8217;s been a little while since my last post. My recent work schedule and Turkey Day played a part in that. I&#8217;ve been working .com hours on a super cool project. (I mentioned the TERRA group in an earlier post.) I&#8217;ve learned so much in the last couple of weeks. It&#8217;s amazing what a hard [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diginit.wordpress.com&blog=32913&post=23&subd=diginit&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It&#8217;s been a little while since my last post. My recent work schedule and Turkey Day played a part in that. I&#8217;ve been working .com hours on a super cool project. (I mentioned the TERRA group in an earlier post.) I&#8217;ve learned so much in the last couple of weeks. It&#8217;s amazing what a hard deadline and a shifting set of requirements will do to your web programming skills. All the hard work is about to bear fruit as as the <a href="http://www.lifeonterra.com/">new TERRA web site</a> is about to go live. Have a look at a different kind of digital library.</p>
<p>But, that&#8217;s not the point of this post&#8230; I wanted to share a little code that made some data conversion very simple over the course of the TERRA project. It&#8217;s a simple little php function that converts a <a href="http://dev.mysql.com/doc/refman/5.0/en/timestamp-4-1.html">MySQL timestamp</a> into <a href="http://en.wikipedia.org/?title=RFC_0822">an RFC 822 date format</a> (For the project, we stored the item update fields as timestamps and then converted them when we generated our various XML feeds. RFC 822 or RFC 2822 are necessary for valid feeds.) Here&#8217;s the php function in all its glory:</p>
<p>//function converts mysql timestamp into rfc 822 date<br />
function dateConvertTimestamp($mysqlDate)<br />
{<br />
$rawdate=strtotime($mysqlDate);<br />
if ($rawdate == -1) {<br />
$convertedDate = &#8216;conversion failed&#8217;;<br />
} else {<br />
$convertedDate = date(&#8216;D, d M Y h:i:s T&#8217;,$rawdate);<br />
return $convertedDate;<br />
}<br />
}<br />
//end dateConvertTimestamp</p>
<p>You call the function by including it on the page and using the following code:</p>
<p>$newPubdate = dateConvert(&#8220;$stringToConvert&#8221;);<br />
echo $newPubdate;</p>
<p>Where $stringToConvert would be any MySQL timestamp value that needs conversion.</p>
<p>In the end a string like this &#8220;2005-05-17 12:00:00&#8243; looks something like this &#8220;Tue, 17 May 2005 12:00:00 EST&#8221;. You could also reverse the conversion using this php function:</p>
<p>//function converts rfc 822 date into mysql timestamp<br />
function dateConvert($rssDate)<br />
{<br />
$rawdate=strtotime($rssDate);<br />
if ($rawdate == -1) {<br />
$convertedDate = &#8216;conversion failed&#8217;;<br />
} else {<br />
$convertedDate = date(&#8216;Y-m-d h:i:s&#8217;,$rawdate);<br />
return $convertedDate;<br />
}<br />
}<br />
//end dateConvert</p>
<p><strong>NOTE: If/when you copy and paste the above code, make sure all &#8221; (double quotes) and &#8216; (single quotes) are retyped. WordPress is doing a number on the proper format.</strong></p>
<p>I just wanted to share the wealth a bit. If you&#8217;ve got questions or suggestions, don&#8217;t be shy about dropping a comment. I&#8217;ll be home in Wisconsin for the next several days, but I&#8217;ll have limited internet access there.  I&#8217;ll try to answer questions if they arise.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/diginit.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/diginit.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/diginit.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/diginit.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/diginit.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/diginit.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/diginit.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/diginit.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/diginit.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/diginit.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/diginit.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/diginit.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=diginit.wordpress.com&blog=32913&post=23&subd=diginit&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://diginit.wordpress.com/2006/11/30/anatomy-of-a-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e9c3e8cd1eecfd6a197f17ede70b82a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">diginit</media:title>
		</media:content>
	</item>
	</channel>
</rss>