Tag Archives: RSS

Can Twitter Replace the RSS Feed Readers


I’m sure this is not the first time you’ve been asked this question. However there’s nobody today that doesn’t wonder the answer. For me – yes, twitter can replace the RSS feed readers, and NO – feed readers are awsome!


First of all why do I use a feed reader? I’m simply seeing what’s in it and barely read the article from the reader, but rather I jump to the site, and what’s happening often in twitter is the same scenario, I just see what’s in the tweet and if it seems to be interesting to me I jump to the link (if there’s a link). The good thing is that the tweets are limited and I’m focused. That’s why twitter is my favorite social site. I can follow all of the interesting people I know from their blogs. So perhaps twitter is becoming more useful than the feed readers.


In other hand in twitter you’ve to stay all the day long to get all the tweets you need. The timeline is quickly changing and sometimes you get lots of “junk”. While in the feed reader you’ve all the “important” posts as an incoming mail. You cannot miss anything! That’s why I cannot forget the feed readers they are doing a great job!

Media RSS and ZF – Part 2

Here’s the promised chunk of code making the most simple bridge between Zend Framework and Media RSS.

Step 1

Just add a simple action in a controller:

class IndexController extends Zend_Controller_Action
	public function indexAction()
	    $this->getResponse()->setHeader('Content-Type', 'application/xml');
	    $this->view->somevar = 'some value';
	    echo $this->view->render('index/index.xml');

Step 2

After you’ve setup the xml file as a view script – you can simply access it as a normal Zend Framework view:

<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:av="http://www.searchvideo.com/schemas/av/1.0">
   <title><?php echo $this->somevar ?></title>
   other media rss elements

Zend Framework and Media RSS

The Problem

Since native RSS format is not designed to deliver media content, there is a need for newer format supporting video and audio. There is such format – Media RSS introduced by Yahoo! in 2004. Actually now RSS supports some king of pseudo audio and video with the enclosure tag.

Inserting Media In RSS with Media RSS

Although there is a standardized format, there is not a Zend Framework native module. There is however a proposal, but that’s far not enough.

Possible Solutions

For me there are two possible solutions. The first is writing Zend_Feed_Mrss and extend the Zend_Feed_Rss functionality, but that appears to be a non-trivial task. The second solution is to write custom view returning XML, which I’m choosing for now. I hope I can paste some code soon!

Retrieving YouTube Channel’s Videos with Zend_Gdata_YouTube


Zend Framework gives you the possibility to interact with Gdata services, which are provided by most of the Goolge services. You can find more on the docs page of Zend_Gdata. The basic principle is that you can connect a service with you API key, given by Google. What I’m about to show you is how do connect such a service.

In theory Zend_Gdata depends on Zend_Http_Client and you’ve to connect it with an instance of this class.

// 1. setup API key
$apiKey = 'your_api_key_here';
// 2. retrieve videos via GData Atom
$client = new Zend_Http_Client();
$gdata = new Zend_Gdata_YouTube(null, 'my-app', null, $apiKey);

Note that you’ve to replace your API key in the chunk above.

Now once that you’ve connected the YouTube service you can iterate through the entries from the video feed.

$videoFeed = $gdata->getUserUploads('username');
foreach ($videoFeed as $entry) {
    echo $entry->getTitle();

The thing is that you can modify a bit the code above. As ZF docs says if you don’t setup a Zend_Http_Client a default with default configuration, so you can omit this and simple write:

// 1. setup API key
$apiKey = 'your_api_key_here';
// 2. retrieve videos via GData Atom
$gdata = new Zend_Gdata_YouTube(null, 'my-app', null, $apiKey);