Possible Duplicate:
facebook app getting redirected out canvas view
I have developed an Facebook Application. I have posted the index.php over here. When I click on the App icon from my facebook account i am redirected to the www.mywebsite.com/facebook/index.php page. It should redirect me to the canvas URL of my App - apps.facebook.com/example/, but even after I interchange the appBaseUrl and baseUrl addresses in the code it still gets redirected to my website.
I have used official php-sdk 3.0 that can be downloaded from https://github.com/facebook/php-sdk .
What is the problem? Why is the app not going to my canvas page on Facebook? What changes I have to make in the code below to resolve my problem? If Any one can help me on this, please do answer.
$fbconfig['appid' ] = "XXXXXXXXXXX";
$fbconfig['secret'] = "XXXXXXXXXXXXXXXXXXXXXXXXXXX";
$fbconfig['appBaseUrl'] = "https://apps.facebook.com/example/";
$fbconfig['baseUrl'] = "http://www.mywebsite.com/facebook/";
include_once "facebook.php";
$facebook = new Facebook(array(
'appId' => $fbconfig['appid'],
'secret' => $fbconfig['secret'],
'cookie' => true,
));
$loginUrl = $facebook->getLoginUrl(
array('scope'=>'email,publish_stream,user_birthday,user_location'));
if (!(isset($_GET['code'])))
echo "<script type='text/javascript'>top.location.href = '".$loginUrl."';</script>";
else
{
$user = $facebook->getUser();
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
err($e);
$user = null;
}
$userInfo = $facebook->api("/$user");
function err($d){
echo '<pre>';
print_r($d);
echo '</pre>';
}
}