13
votes

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 :

<![CDATA[
This feed URL is no longer valid. Visit this page to find the new URL, if you have access: &lt;a href=&quot;https://www.facebook.com/profile.php?id=<FB_ID>&quot;&gt;https://www.facebook.com/profile.php?id=<FB_ID>&lt;/a&gt;
]]>

The URL I'm using is:

https://www.facebook.com/feeds/page.php?id=<fb_id>&format=rss20&access_token=<my_page_token>

I don't have an age restriction set nor a country restriction:
enter image description here

Further, I've tried it with and without my access token.

As noted in the comments below, the JSON URL is indeed working:

https://graph.facebook.com/<page_name>/feed&https://www.facebook.com/<page_name>/‌​feed?access_token=<token>

What is going on here / how do I resolve the problem?

5
Without knowing the page ID there's nothing we can do to see what your issue is - is the page accessible at https://graph.facebook.com/<PAGE ID>? - Igy
Yes, that returns a chunk of json with the correct info. - ylluminate
Interesting, the following does indeed give me JSON output: https://graph.facebook.com/<page_name>/feed&https://www.facebook.com/<page_name>/feed?access_token=<token> - ylluminate
Then go to the page on Facebook and see if there's a link there for an updated RSS feed - The pages I have give this link: feed://www.facebook.com/feeds/page.php?id=PAGE_ID_GOES_HERE&format=rss20 - Igy
Here is a good tutorial also: ahrengot.com/tutorials/facebook-rss-feed - Eric Leroy

5 Answers

14
votes

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 :)

23
votes

Here are my directions.

  1. Go to facebook and right-click profile image to get URL and copy the ID
  2. Go here https://graph.facebook.com/ID_GOES_HERE
  3. Take the ID value that is listed on the resulting page and copy it
  4. Go here and paste the new ID https://www.facebook.com/feeds/page.php?id=ID_GOES_HERE&format=rss20
  5. Copy and paste URL into your feed reader
2
votes

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

2
votes

Two easy steps to get the RSS/Atom feed :

This url generates an Atom feed, but you can change it.

0
votes

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.