Adding my blog’s feed to my personal site

I have my personal web page hosted in a free hosting service. Basically it’s a dojo application working with a Zend Framework Backend. I had the idea of include a the last posts of my blog from the rss to the front page (original isn’t it?), and I start to develop it.

I started using Zend_Feed to fetch the RSS from my blog. The idea of my personal site was to develop a web application based on dojo framework so I decide to use the dojo way using sounds cool but I faced with the first problem. Due to security reasons XHR requests can’t be done to a different domain. My personal page and the url of the blog’s feed were under different domain.

Problem 1: XHR with different domains.

To solve this problem I must create a proxy with PHP to RSS feed in my personal page. With this proxy XHR requests will be in the same domain, so will work correctly. the proxy worked perfectly in my local computer but when I upload it to my hosting I realized that it didn’t work.

Problem 2: The hosting of my project doesn’t allow php’s socket functions

As I see in php.ini. some PHP functions (socket functions for example) are disallowed in the server. Because of that my code does not work. Surfing into Zend framework source code (open source is cool). I saw Zend_Feed uses Zend_Http_Client_Adapter_Socket. My hosting allows me to use curl extension instead of socket functions. But Zend Framework does not have a Zend_Http_Client_Adapter_Curl. So other problem.

Problem 3: Zend_Http_Client with Curl

As I read in some newsgroup my problem with my hosting, curl and sockets was not only mine. Zend Framework doesn’t not have a curl adapter in the production tree but they have a Zend_Http_Client_Adapter_Curl in the incubator. This adapter is not fully tested and it can crash behind proxies and things like that but it sounds good for my situation. Using this adapter the code works in my local server and in my hosting. that’s sounds good but there is other problem

Problem 4: CPU usage

Looking in the statistics of my site in the hosting I realized that the CPU usage was hight. The application is a client side application and this CPU usage graph shows me the problem. Curl functions are slow and my rss proxy is consuming too much cpu time. It sounds I am under a no-solution problem. I need a proxy to avoid XHR cross domain restriction but this proxy uses too much CPU in my poor-man- hosting. Solution: turn the logic to the client and and do all the job with javascript.

Finding some RSS reader with js I faced with GFdynamicFeedControl. Really easy to use. It also has a wizard to generate code to copy and paste. Of course the generated code didn’t work in my application but hacking a bit I have finally my RSS feeds in my personal page. GFdynamicFeedControl allow you to mix different RSS so y also include the rss of my github account with the source code.

<div id="feed-control">
    <span style="color:#676767;font-size:11px;margin:10px;padding:4px;">Loading...</span></div>
@import url("");

google.load('feeds', '1');
    var options = {
        stacked : true,
        vertical : true,
        title : "Feeds"
    new GFdynamicFeedControl(gamJs.feeds, 'feed-control', options);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.