How To Set Up A Facebook RSS Feed Reader Application For Your Blog

Version 1.0
Author: Falko Timme

This guide shows how you can build an RSS feed reader application for the social network Facebook that will display your blog's/web site's RSS feed on the profile pages of Facebook users (that have installed the RSS feed reader application). Each item of the RSS feed will have a Share button so that people can share the story with their friends, and the application will have an Invite link so that people can invite up to ten friends at once to also install this feed reader application. I will use PHP5 to build the RSS feed reader application. To parse the RSS feed and generate HTML from it, I will use Magpie RSS.

You can see this application in action by installing the HowtoForge RSS Feed Reader for Facebook.

This document comes without warranty of any kind! I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

This guide is based on a real-world example, the HowtoForge RSS Feed Reader for Facebook, and I will use the real URLs and scripts in this example (only replacing secret data like the API key and the Secret).

As I mentioned before, I'm using PHP5 to build this application, using Facebook's PHP Client Library. Theoretically you can use PHP4 as well, but the client platform is optimized for PHP5, so you should use that if possible.

I'm using the host fb.howtoforge.com in this example to host the application; it is a PHP5 capable web site.

Before you can start writing your own Facebook application, you must register on Facebook (if you don't have an account yet) and add the Facebook Developer Application to your account, as described on http://developers.facebook.com/get_started.php:

Afterwards, you should start with these examples to get used to creating Facebook apps. However, I will use these examples in this tutorial again (at the beginning) to make sure that everything is working as expected before I try to write my own stuff.

 

2 Set Up A New Application

Before we start programming our application, we must tell Facebook about it, and Facebook will then give us an API Key and a Secret which we need to build the application.

Now that you've added the Facebook Developer Application to your account, go to your Facebook page - you should now see the Developer app in the left navigation. Click on it. The Developer page opens, where you click on the + Set Up New Application button (near the upper right corner):

Now we're on the New Application page. I want to name my app HowtoForge RSS Feed Reader, so I fill this in as Application Name. I check the checkbox below this field to show that I agree to the terms of the Facebook platform. Then I fill in a support email address (should be an address where you or your fellow developers can be contacted). The Callback URL is the location where the app will be hosted. Mine will be hosted under http://fb.howtoforge.com/fb/htf_feed_reader/, so I fill that in. The Canvas Page URL is the Facebook address you'd like your app to have. Fill in your desired address (e.g. http://apps.facebook.com/htf_feed_reader), and the form will then tell you if the address is still available or not. Then select Use FBML and Website (both should already be the default selection):


One important note regarding the Callback URL: It is absolutely important that the URL ends with a slash (/); if it doesn't, people will later on get the famous The URL ... did not respond. error whenever they visit your app in their accounts, like this:


Next, still on the New Application page, fill in the other options. Answer Can your application be added on Facebook? with Yes. You can leave the TOS URL field empty if you don't have any terms of service. Add additional developers if there are any. As Post-Add URL, you use the Canvas Page URL (http://apps.facebook.com/htf_feed_reader in my case). Fill in a description for your application. The Post-Remove URL can be left empty as well. In the Default FBML field, you can enter some text that you would like to appear on the user profiles if your app doesn't deliver content for the profile page. Then select in which profile column you'd like your content to appear. As there's lots of text in RSS feeds, the wide column is a good choice in our case:

Further down on the New Application page, there's just on other field we must fill out, the Side Nav URL. Again, this is the same as the Canvas Page URL (http://apps.facebook.com/htf_feed_reader in my case). All other fields can be left empty. Click on Submit afterwards:

You should now be on the My Applications page where you can find the API Key and the Secret for your app. Copy them, we'll need them for our app later on.

Further down on the My Applications page, you will see a link to the PHP (4 and 5) Client Library:

Share this page:

4 Comment(s)