0
我正在遵循該教程。 http://developers.facebook.com/docs/authentication/臉譜圖API連接
但它重定向兩次。首先用代碼= NULL,下次它將有代碼..我不想重定向時代碼= NULL .plz告訴我的解決方案。這是我的完整代碼。
$code = $_REQUEST['code'];
if(empty($code)) {
$dialog_url="https://www.facebook.com/dialog/oauth?client_id=$app_id&redirect_uri=$my_url&scope=email";
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
$token_url = "https://graph.facebook.com/oauth/access_token?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret="
. $app_secret . "&code=" . $code;
$access_token = file_get_contents($token_url);
$graph_url = "https://graph.facebook.com/me?" . $access_token;
$user = json_decode(file_get_contents($graph_url));
如何來重定向你兩次?你的'$ my_url'和這個頁面一樣嗎? – ifaour 2011-04-28 20:13:29