<?php
$app_id = "181247898619054";
$app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
$my_url = "https://apps.facebook.com/wellnessq/";
session_register();
session_start();
if (!isset($_REQUEST["code"]))
{
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
$dialog_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&scope=email&state="
. $_SESSION['state'];
echo("<script> top.location.href='" . $dialog_url . "'</script>");
exit;
}
$code = $_REQUEST['code'];
{
$token_url = "https://graph.facebook.com/oauth/access_token?"
. "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url)
. "&client_secret=" . $app_secret . "&code=" . $code;
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$graph_url = "https://graph.facebook.com/me?access_token="
. $params['access_token'];
$user = json_decode(file_get_contents($graph_url));
}
?>
有什么想法吗?如果你想亲自看到错误,请告诉我,我会发布在哪里找到它们。谢谢。
答案 0 :(得分:0)
您可以使用PHP标头重定向到您的链接吗?
header( 'Location: http://www.yoursite.com/new_page.html' ) ;