Facebook RSS reader app - error!?

Discussion in 'HOWTO-Related Questions' started by parakeet, Dec 12, 2007.

  1. parakeet

    parakeet New Member

    I'm following your howto on building an RSS reader app for Facebook at http://www.howtoforge.com/rss_facebook_app_php_p2

    Despite following the instructions closely, my PHP is throwing an error at page 2...

    Parse error: syntax error, unexpected '{' in /home/myusername/public_html/fb/pcuk_feed_reader/appinclude.php on line 13

    Any help please? This is happening repeatedly and driving me nuts!
  2. parakeet

    parakeet New Member

    Okay, I've solved this problem (I didn't have PHP5 but I've followed two bits of advice at http://wiki.developers.facebook.com...pected_.27.7B.27_in_appinclude.php_on_line_13 to switch to PHP4 classes and remove the "try" command from my script.

    But I have another problem -- As per the instructions pn page 2 (http://www.howtoforge.com/rss_facebook_app_php_p2), I have modified and added the appinclude.php and index.php and, when I visit the Callback URL, indeed I see a screen on which I am invited to login to my app.

    HOWEVER, the next page is not the app add confirmation as the instructions suggest, it's the "hello userid" message... I can't see where to add/remove the app at all!

    As per guidance at http://wiki.developers.facebook.com...pected_.27.7B.27_in_appinclude.php_on_line_13, I removed the "try" command from my appinclude.php, which is now as follows...

    require_once 'facebook.php';

    $appapikey = 'mykey';
    $appsecret = 'mysecret';
    $facebook = new Facebook($appapikey, $appsecret);
    $user = $facebook->require_login();

    //[todo: change the following url to your callback url]
    $appcallbackurl = 'http://www.robertandrews.co.uk/fb/pcuk_feed_reader/';

    //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);

    index.php is...

    require_once 'appinclude.php';

    echo "<p>hello $user</p>";

Share This Page