13

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?

9
  • 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
    Commented Mar 14, 2012 at 19:44
  • 1
    Yes, that returns a chunk of json with the correct info.
    – ylluminate
    Commented Mar 14, 2012 at 19:56
  • 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
    Commented Mar 14, 2012 at 20:04
  • 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
    Commented Mar 14, 2012 at 20:05
  • 2
    Here is a good tutorial also: ahrengot.com/tutorials/facebook-rss-feed
    – Eric Leroy
    Commented Oct 15, 2012 at 0:37

5 Answers 5

23

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
3
  • 6
    I get { "error": { "message": "A user access token is required to request this resource.", "type": "OAuthException", "code": 102 } } when I try to access the graph URL (step 2 above) with the profile ID. Have they restricted this access or could it be related to privacy settings?
    – Dan
    Commented Jan 22, 2013 at 15:53
  • There is a little issue in this approach. The character encoding for non Latin language contents.
    – SaidbakR
    Commented Aug 7, 2014 at 6:03
  • 4
    This no longer works as this method has been deprecated. Commented Jul 28, 2015 at 18:35
14

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

3
  • Thanks very much for this enlightenment. Are you aware of any work going on in the way of WordPress plugins at the moment that have integrated this already?
    – ylluminate
    Commented Mar 20, 2012 at 9:34
  • No that I know. I'm using feedwordpress.radgeek.com but for that I need the feed as atom, rss or something like that. Maybe it's a good idea to create a plugin for WP =)
    – lu1s
    Commented Mar 20, 2012 at 15:28
  • Agreed, it is a prime opportunity for someone to swipe this landscape.
    – ylluminate
    Commented Mar 20, 2012 at 17:48
2

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

Two easy steps to get the RSS/Atom feed :

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

5
  • Which one ? Both are working for me. You need to append the id you obtained from the first site after the "id=" in the second url, if that's your problem.
    – antou
    Commented Jun 23, 2015 at 9:25
  • giving my fb ID to first link always shows error message! Commented Jun 23, 2015 at 9:48
  • You have to enter the page's url (for example http://www.facebook.com/thisIsMyNameOnFacebook), and you get the ID.
    – antou
    Commented Jun 23, 2015 at 13:58
  • i know that because that is hint in edit text but i can't get it for facebook.com/MatthewSantoroOfficial . Anyway i found the alter net solution. your suggested site show me error Unable to lookup Facebook numeric ID. Please try again, double-checking the URL of your personal Facebook profile page. Commented Jun 24, 2015 at 4:20
  • Oh, strange, I never had that issue before. Fair enough :)
    – antou
    Commented Jun 24, 2015 at 14:19
0

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.

1
  • Please do not put any signatures into your texts - your user box is right next to it anyways.
    – Sven
    Commented Oct 11, 2012 at 8:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.