0
即時通訊使用PHP SDK讓用戶授權我的應用程序。有點棘手的是我,我在一個標籤中做這個。重定向uri將打破標籤'iframe',只是作爲一個普通的應用程序打開,我不想要這個。我怎麼能讓它保持在頁面標籤iframe中。下面是我的代碼;facebook PHP SDK redirect_uri頁面標籤
<?php
include("utility.php");
include("db_setup.php");
require_once "base_facebook.php";
require("facebook.php");
$facebook = new Facebook(array(
'appId' => 'xxxxxx',
'secret' => 'xxxxxx',
));
$conn = connectUserDB();
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
//$user_profile = $facebook->api('/me?fields=name,id,email');
header('Location: submitted.php') ;
} catch (FacebookApiException $e) {
//print_r($e);
$user = null;
}
}
// $user is null : $user is either not logged in or the token is not valid
else if(!$user) {
$params = array(
'scope' => 'email',
'redirect_uri' => 'submitted.php'
);
$loginUrl = $facebook ->getLoginUrl($params);
echo '<script type="text/javascript">';
echo 'top.location.href = " '.$loginUrl.' " ; ';
echo '</script>';
}
?>
我想繼續使用php。我試着將它重新導向到標籤,但是這與ipad有關。 – 2013-03-06 09:37:34
ipads的問題究竟是什麼? – Darvex 2013-03-06 09:41:05
我試着將其重新導向到選項卡的主頁面(http://www.facebook.com/pagename/app_3917315842xxxx),但是當我點擊按鈕轉到主頁面時,它會一直返回到選項卡網址。 – 2013-03-06 09:44:40