Facebook RSS feed app invite page deprecated

Discussion in 'HOWTO-Related Questions' started by godrox, Oct 24, 2007.

  1. godrox

    godrox New Member

    I used the tutorial for how to set up a Facebook reader application for your blog and it worked great until just recently when Facebook deprecated the notifications.sendRequest API method.

    I know get this error when sending invites:

    Code:
    Fatal error: Uncaught exception ‘FacebookRestClientException’ with message ‘Unknown method (this function has been disabled - see http://developers.facebook.com/news.php?story=42)’ in /home/rest_of_path/facebookapi_php5_restlib.php:390 Stack trace: #0 /home/rest_of_path/facebookapi_php5_restlib.php(270): FacebookRestClient->call_method(’facebook.notifi…’, Array) #1 /home/rest_of_path/invite.php(18): FacebookRestClient->notifications_sendRequest(Array, ‘Drink and Flow …’, ‘
    Can anyone tell me how to update the invite page for this app with Facebook's new invite system? Or even update the HOWTO tutorial on it?
     
  2. godrox

    godrox New Member

    Okay, I updated it myself. In case anyone else is looking for directions:

    1. Delete the friendselect.php file from your host. It's deprecated and is no longer needed.

    2. Overwrite facebook.php and facebookapi_php5_restlib.php on your host with the new ones from the Facebook client package.

    3. Open invite.php and delete everything in it. Replace it all with this:

    Code:
    <?php
    include_once 'conf.php';
    
    require_once('appinclude.php');
    
    $facebook->require_frame();
    $user = $facebook->require_login();
    
    // Render the friend selector in an iframe.
    ?>
    <div style="padding: 10px;">
      <fb:request-form method="post" action="index.php" content="DESCRIPTION OF YOUR APP HERE <?php echo htmlentities("<fb:req-choice url=\"CANVAS_PAGE_URL_HERE\" label=\"Sweet! Add it!\" />"); ?>" type="SHORT APP NAME" invite="true">
      <fb:multi-friend-selector actiontext="Select your friends to use the APPLICATION NAME!" rows="3"/>
      </fb:request-form>
    </div>
    <?php
    ?>
    Replace "DESCRIPTION OF YOUR APP HERE" with a brief description of your application.

    Replace "CANVAS_PAGE_URL_HERE" with your canvas URL. Be sure to leave the backslash intact.

    Replace "SHORT APP NAME" with a very short name of your app. No longer than 15 characters or it'll cut off in people's right sidebar when they receive the invite notification.

    Replace "APPLICATION NAME" with the name of your application.

    Save the file and overwrite your existing one. The invitation system now works again.
     
  3. ray_gillespie

    ray_gillespie New Member

    That's really helpful, thanks!

    Do you know of any way to limit the number of threads? :)
     
  4. falko

    falko Super Moderator Howtoforge Staff

  5. ray_gillespie

    ray_gillespie New Member

    That's cool, thanks!
     
  6. spectrelives

    spectrelives New Member

    No longer working?

    Hi Falko and others.

    I'm trying to do this tutorial desperately as I am using it to help me do a uni assignment (with full references to HowToForge of course!). However I'm concerned that ever since the new Facebook layout took over, this tutorial no longer seems to work.

    There is a problem with isAppAdded() which will always return false now. This leads to an infinite loop (Too Many Redirections) error and the whole app breaks. Facebook reckon this is no longer necessary as the checks are done within require_login() automatically.

    When this try/catch block is removed, however, I run into an even bigger problem. My application will not load the HowtoForge feed, nor any feed. Instead, I get:

    Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Session key invalid or no longer valid'.

    and sometimes, instead I get the Fatal Error "Incorrect Signature".

    Is this just me? or is the tutorial broken?
    If it's just me, I don't know why as I followed the tutorial exactly step by step up to page 3 and it will not load any RSS feeds like it should. :(

    Please, please help... any code I could try?
    Thank you
     
  7. falko

    falko Super Moderator Howtoforge Staff

    The feedreader is still working for me, even with the new Facebook design. I guess that something's wrong with your session key.
     
  8. spectrelives

    spectrelives New Member

    How strange. Just curious, so with the new Facebook Layout, is the Feed reader displaying in the new wall as a profile box in the same way? What about dislaying as a Profile Tab, is that automatically working too?

    Back to my problem: apologies, because I am a beginner at all of this, but what is the best way to clear/refresh my session key? I don't really understand how session keys are stored, where they are stored, or how come mine is apparently broken.

    This might be a clue: it works the very first time I install the app. Once I allow it access in Facebook, it loads. Then, the next time I refresh or go to the application again, it shows the error. This is regardless of whether I log out of Facebook, shut down the browser window, clear cookies, or restart my computer. The only thing I can do to get it to work is to REMOVE the application, then re-add it all over again. Sound strange to you?

    This incorrect signature / invalid session key has has me stumped for days. Is it a PHP method I have to call, or a FBML method? Any tips would be massively helpful and thanks again for your time on this one :)
     
  9. falko

    falko Super Moderator Howtoforge Staff

    It's displaying on the Boxes tab, but not on the Wall tab.

    Did you try the procedure from the tutorial to get the session key?
     
  10. spectrelives

    spectrelives New Member

    Session Key

    Well, when you say 'the procedure to get the session key' do you mean this block of code?


    //catch the exception that gets thrown if the cookie has an invalid session_key in it
    try {
    if (!$facebook->api_client->users_isAppAdded()) {
    $facebook->redirect($facebook->get_add_url());
    }
    } catch (Exception $ex) {
    //this will clear cookies for your application and redirect them to a login prompt
    $facebook->set_user(null, null);
    $facebook->redirect($appcallbackurl);
    }


    When I put that code in, it resulted in Error: too many redirections.
     
  11. falko

    falko Super Moderator Howtoforge Staff

  12. spectrelives

    spectrelives New Member

    Solution

    Ah. Well, here is where my application differs to the original, my RSS feed is supposed to be different for each user, behind a login, hence I can't use an infinite key.

    However, I have found out what was causing my Incorrect Signature error. I went right back to square one and started the tutorial again, and found out that I had mistakenly set the app setting to "Desktop" instead of "Website".

    Soon as I switched that setting, the bug was gone.

    Isn't that typical, the solution was so simple and yet so hard to see.

    So right now, I have a working RSS feed, but my next challenge will be to differ it from the tutorial to make the feed content different for each user, based on their previously saved customisation settings on an external website where the feed is located. And I have very little idea how to do that really. *sigh* How would I ask for the external site's login details and then pass them from the facebook app to the external website?
     
  13. falko

    falko Super Moderator Howtoforge Staff

    I'm sorry, but I'm afraid I can't help here. I haven't tried to build an app that shows different content for different users...
     
  14. spectrelives

    spectrelives New Member

    that's ok. thanks anyway :)
     
  15. latexfanclub

    latexfanclub New Member

    "No content" error on wall and boxes

    I've followed the "How To Set Up A Facebook RSS Feed Reader Application For Your Blog" tutorial and seem to have fallen at the final hurdle.

    Although the script displays my new blogs posts on the Canvas Page correctly, it does not display them properly on the boxes page or on the wall. (I understand that due to the new version of Facebook they aren't displaying properly on the wall for other people, but the boxes display is working for them - it isn't for me).

    I get this error message:

    I would really appreciate help on this, I've been tearing my hair out all day!
     
  16. adroussel

    adroussel New Member

    I could make everything display on the profile using:

    <fb:add-section-button section="profile" />

    and replacing "$fbml .="
    by "$fbml_main ="
    for what has to be displayed on profile.

    This tutorial helped me a lot! even if a little outdated
    It'd be great to renew it

    I almost could finish the tut. Stuck when pinging my cronjob.php doesn't refresh the displayed feed...

    When I ping cronjob.php, it displays a white page , I guess this is normal behaviour but I maybe have an ivalid infinite key... but no warning. How to know.
    Help appreciated
     
  17. Linda Rosmunda

    Linda Rosmunda New Member

    I go to invite friends or even send messages about my facebook apps, the preview message blocks the confirmation button that I need to send the message. I can only see part of the cancel button and pressing enter just refreshes the message. Anyone know how to fix this?
     

Share This Page