How do I do this, the INDEX.PHP file is created with the following
//if user is logged in and session is valid. if ($fbme){ //fql query example using legacy method call and passing
parameter try {$ fql = "select name, hometown_location, sex, pic_square from user, where uid =". $ UID $ param = array ('method' => 'fql.query', 'query' => $ fql, 'callback' => 'http://apps.facebook.com/yoursite/'); $ fqlResult = $ facebook-> api ($ param); } catch (Exception $ o) {q ($ o); }}
Then enter your canvas URL at http://yoursite.com/INDEX.php
The callback URL in the above code, which will be in the INDEX.PHP sets, where permission is granted for access.
FBMain.php is as follows:
//set application urls here $fbconfig['http://www.yoursite.com/iframeapp/YOURMAINPAGE.php/']
= "http://www.tyoursite.com/YOURMAINPAGE.php/";
$fbconfig['http://apps.facebook.com/CANVASBASEURL']
= "http://apps.facebook.com/CANVASBASEURL";
$uid = null; //facebook user id try{ include_once "facebook.php"; } catch(Exception $o){ echo '<pre>'; print_r($o); echo '</pre>'; } // Create our Application instance. $facebook = new Facebook(array( 'appId' => $fbconfig['APPID'], 'secret' => $fbconfig['SECRET'], 'cookie' => true, )); //Facebook Authentication part $session = $facebook->getSession(); $loginUrl = $facebook->getLoginUrl( array( 'canvas' => 1, 'fbconnect' => 0, 'req_perms'=>'email,publish_stream,status_update,user_birthday,user_location' ) ); $fbme = null; if (!$session) { echo "<script type='text/javascript'>top.location.href
= '$ loginUrl'; "; Exit;} else {try {$ uid = $ facebook-> getUser (); $ fbme = $ facebook-> api ('/ me');
} catch (FacebookApiException $e) { echo "<script type='text/javascript'>top.location.href
= '$ loginUrl'; "; Output; } }
function d($d){ echo '<pre>'; print_r($d); echo '</pre>'; } ?>
Hope this is a little clearer. It took me a while to figure this out, but I got there, I thought I'd help.