Finally!

Thursday, October 30, 2008

So, I'm not particularly fond of Facebook in general, but I have a number of friends and coworkers who use that site.  The one thing I like about it is that it has the same kind of status updates I get with Twitter.

Fortunately, Facebook gives me the option to add Twitter as an application, so that when I make a post on Twitter, it automatically shows up in my Facebook status feed.  But what I really wanted to do was to find a way to remotely access the Facebook status updates, so I could combine them with the Twitter feed on my own website.  I searched through the API and the developer forum, but could not find anything useful.  Just yesterday I found a post in the forum stating bluntly, "There is no way to retrieve feed[s] from facebook" (posted on 8/26/08).  I even tried to log in remotely with an HTTP post, and grab the statuses HTML page, intending to parse it, but the site would not let me log in that way.

This morning, however, I found my solution.  On Facebook, if you click on "Friends" in the main menu, you will be taken to the status updates page, and in the left margin there is a link to an RSS feed of the same (labeled "Friends' Status Feed").  Oh, finally!  I don't know if this was a recent addition to Facebook, or if I just never happened across this page before.  In any case, the rest was easy.  I was able to remotely access the feed (as one would expect), and then I just merged the data with my Twitter feed, and sorted the lot by date using the php array_multisort function.  (See Example #3 — very clever application.  I'm sure I would not have thought of that solution on my own.)

Now, the Facebook feed does not give you access to the user icons the way Twitter does, and the output was looking a little bland.  I like pictures.  They liven things up.  So, I figured that since I have a limited number of contacts on Facebook, I'd simply save a copy of each icon locally, and just reference the image by username from the status feed.  The result?  A custom Twitter-Facebook mashup on my homepage, just the way I wanted it.

RSS is your friend.

Leave a comment

Share on Twitter
It is the Spirit who gives life; the flesh profits nothing.  The words that I speak to you are spirit, and they are life.  Yet there are some of you who do not believe...  Therefore I have said to you that no one can come to Me unless the Father has enabled him.
— John 6:63-65