Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Facebook App Development Brick Wall

  • 15-03-2011 01:22PM
    #1
    Registered Users, Registered Users 2 Posts: 55,623 ✭✭✭✭


    Hi all,

    I'm trying to develop a facebook app for our software, but I'm falling at the first hurdle (getting a basic "hello world" app working). The developer documentation is awful, and the error I'm getting is so vague that I don't know how to move forward with this.

    The error I'm getting is "The URL returned HTTP code 200 and no data."

    My simple app (with sensitive info removed) is:

    [PHP]<?php

    require 'facebook.php';

    // Create our Application instance.
    $facebook = new Facebook(array(
    'appId' => 'myid',
    'secret' => 'mysecret',
    'cookie' => true,
    ));


    $session = $facebook->getSession();

    if (!$session) {

    $url = $facebook->getLoginUrl(array('canvas' => 1,'fbconnect' => 0));

    echo "<script type='text/javascript'>top.location.href = '$url';</script>";

    } else {

    try {

    $uid = $facebook->getUser();
    $me = $facebook->api('/me');

    $updated = date("l, F j, Y", strtotime($me));

    echo "Hello " . $me . "<br />";
    echo "You last updated your profile on " . $updated;

    } catch (FacebookApiException $e) {

    echo "Error:" . print_r($e, true);

    }
    }

    ?>[/PHP]

    The code above was taken from a message board post I found (with lots of positive feedback from others to say it worked for them). I'm using the latest facebook.php from their SDK, and the canvas URL is running on PHP5 (phpinfo says its 5.1.6) and CURL is enabled.

    Googling the "200 No data" error above, some people seem to think it might be timeout related, but I don't think so (it comes up pretty quickly). I've tried it now on 2 different hosting providers in Ireland, and both can't be timing out. :)

    Does anyone have any ideas on how to get this working?


Comments

  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Is HTTP 200 not an "Okay" response. You just don't print any data. I'm guessing that is.


  • Registered Users, Registered Users 2 Posts: 55,623 ✭✭✭✭Mr E


    Thanks for the reply, webmonkey.

    I'm echoing stuff to the screen (echo "Hello" etc.)

    If I just do <?php echo "Hello"; ?> it works.
    It seems to be the facebook session stuff that's tripping me up.

    I was playing about more with it tonight. I can get the session stuff working with JQuery (so I'm not using PHP at all). The problem is that it works from my canvas URL (the external link), but not while run from the internal apps.facebook.com link (I just get the facebook header and a white screen)


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    Mr E wrote: »
    Thanks for the reply, webmonkey.

    I'm echoing stuff to the screen (echo "Hello" etc.)

    If I just do <?php echo "Hello"; ?> it works.
    It seems to be the facebook session stuff that's tripping me up.

    I was playing about more with it tonight. I can get the session stuff working with JQuery (so I'm not using PHP at all). The problem is that it works from my canvas URL (the external link), but not while run from the internal apps.facebook.com link (I just get the facebook header and a white screen)
    Maybe your scripts arn't getting loading correctly within facebook? Could be security or paths or something. Check the error console in your browser to see.


Advertisement