Since Facebook changed their privacy settings last year, I’ve been looking for a way to display public updates – and only my public updates – to the world.

But, of course, Facebook has other ideas. I was at first expecting them to show up on my public profile page, but no; it’s an fully public profile or nothing… and you have to be logged in to Facebook to see it. A Twitter-style lifestream is not on the cards, it seems. And you can’t use RSS feeds either, as they include no privacy information, thus you can’t filter for ‘Everyone’ content.

So, I’ve given up on waiting for Facebook to follow up on the initial ‘Everyone’ noise, & have written a PHP Facebook Platform application to retrieve these public updates myself.

The application is at http://apps.facebook.com/publicstatusfeed// http://www.facebook.com/apps/application.php?id=331369174049. The FB app is just an iframe pointing to the application code on my website, at http://vodex.net/publicstatusfeed/.[1. I'm not allowed to use the word 'Facebook' in the application name, hence the different naming.]

I’ve released the application code at http://code.google.com/p/publicfacebookfeed/. Please note this is in an initial release. There is not much documentation, test cases, or any caching, for example. [2. I'd have liked to try out hosting on GitHub, as that's what all the cool kids are using these days, but frankly, since the hassle of using the FB platform, after yet more mucking around with undocumented GitHub command line intricacies I admit I just decided to be lazy.]

How to use

Whew, that was easy. Note that if you’re not OK with my website accessing your Facebook activity, please download the code & set it up yourself on your own server.

I’ve also put up a human-readable diagnostic page, at http://vodex.net/publicfacebookfeed/core.php?uid=YOURFACEBOOKUSERID. Mine is at http://vodex.net/publicfacebookfeed/core.php?uid=802410391.

How it works

Sadly, I didn’t enjoy developing this – Facebook Platform has a reputation for a volatile API & incomplete documentation. In total, it took me around 12 hours (admittedly spread out over some months of leisure time) for what should have been a reasonably simple task.

I also found a few forum posts etc. of other developers attempting this, but no working applications or real guidance. Perhaps no-one is that interested in this area? Statistically speaking, I find it surprising that I am the first to publicly figure this out.

Anyway, do something similar to the below (or check out the code):

  • Your application must request offline_access and read_stream extended permissions.
  • When the user authorises, store their session key (MySQL works just fine). These used to be called ‘infinite session keys’.
  • The session key allows you to access the user’s content without having to go via the Facebook UI. In the script to actually get the content, create your Facebook client and then set the session key to that which you stored earlier. Do not go through requiring permissions again, as that’d trigger the Facebook UI, which you don’t want if e.g. the server is polling an RSS feed, with no human in sight
  • For the content itself, use Stream.get, and not the more obvious (& apparently deprecated) Status.get, as that doesn’t allow querying by privacy. (Hat tip to the Facebook Developer stand at the PHP Conference for this!)
  • Get streams for given userID with privacy of ‘EVERYONE’ and then do interesting things with it.

So there we go; I can now finally have public Facebook activity in this site’s lifestream. If there’s interest in this application (i.e. I’m not just scratching my own itch), I’ll look to proceed further with it.

  1. Yes it works with own public posts! Have you tried obtaining other public information from your own wall this way?

  2. No, but it wouldn’t be difficult now the basics are down; I have access to all my friend’s activities as well, so could easily find all of their public items. Presumably as it’s publicly visible, it wouldn’t voilate any privacy or terms of service agreements… I doubt the other users would see it that way though!

  3. You are using the old php library (‘http://svn.facebook.com/svnroot/platform/clients/packages/facebook-platform.tar.gz’). It use rest api. Do you have tried the new php sdk or the new javascript sdk?

  4. Not yet; I thought about the SDK to allow inline authorization, but as the primary function is to allow server processing of content, it’s not high on the backlog.

    Whilst the new API is impressive, given frustrations with previous iterations of the Platform I’ll wait for it to bed down a while first…

  5. [...] I posted about the Public Facebook Feed, I hinted about the long development time. I’ve also mentioned my use of Personal [...]

blog comments powered by Disqus

Switch to our mobile site