I\'m attempting to pull out a page feed to RSS from Facebook, however each time I attempt to try it, I get an error back in the XML with the following :
<
For an easier way to find page id:
Just view the source for your FB page (or timeline app, previously known as tab), and search for page_id
. Replace it with the code provided.
When there's no page id to be found in the source page, I found the id through the "create a page" link, as in
https://www.facebook.com/pages/create.php?ref_id=the_#_here
ahhhh... so good to have my rss feeds back! Thanks, everyone! :D
Two easy steps to get the RSS/Atom feed :
This url generates an Atom feed, but you can change it.
Here are my directions.
I got with the same problem. After looking for a solution I found that FB silently killed public RSS support. (see this post from Jesse Stay)
I understood that I needed to call the API myself and construct the feed (I also need the feed to be parsed by a WP plugin and other stuff.
So, first of all get an API key (also called app id) and download the PHP Facebook SDK.
Then download the Universal Feed Generator PHP class. It will generate all the required headers and xml for you.
Your php script will be like this:
require('lib/facebook.php'); // require your facebook php sdk
include("feed_generator/FeedWriter.php"); // include the feed generator feedwriter file
$fb = new facebook(array(
'appId' => 'YOUR_APP_ID', // get this info from the facebook developers page
'secret'=> 'YOUR_SECRET_KEY' // by registering an app
));
$response = $fb->api('/spreetable/feed','GET'); // replace "spreetable" with your fb page name or username
// create the feedwriter object (we're using ATOM but there're other options like rss, etc)
$feed = new FeedWriter(ATOM);
$feed->setTitle('Spree Table'); // set your title
$feed->setLink('http://spreetable.com/facebook/feed.php'); // set the url to the feed page you're generating
$feed->setChannelElement('updated', date(DATE_ATOM , time()));
$feed->setChannelElement('author', array('name'=>'Spree Table')); // set the author name
// iterate through the facebook response to add items to the feed
foreach($response['data'] as $entry){
if(isset($entry["message"])){
$item = $feed->createNewItem();
$item->setTitle($entry["from"]["name"]);
$item->setDate($entry["updated_time"]);
$item->setDescription($entry["message"]);
if(isset($entry["link"]))
$item->setLink(htmlentities($entry["link"]));
$feed->addItem($item);
}
}
// that's it... don't echo anything else, just call this method
$feed->genarateFeed();
Note from the future (2013-07-09): Don't listen to my answer anymore. It's old. Facebook has a new API with new features on its query language so don't bother pulling feeds. Try to use their API in a more fun, intelligent way :)