ユーザーIDをエコーするキャンバスアプリに戻ります。何時間もやっています
質問
アプリキャンバスにアプリユーザーの生年月日を表示した友人からコードを与えられました。
ユーザー自身のIDをエコーするために変更しようとしました。それは自分自身(クリエイター)のために機能し、私が開発者として指定した友人のためにも機能します。しかし、他の人にとっては、このエラーをもたらします。
Warning: file_get_contents(https://graph.facebook.com/me?
fields=id&access_token=228073413942115|460d2e1ffd0b4cc6b5cb480d53f60d6e)
[function.file-get-contents]: failed to open stream: HTTP request failed!
HTTP/1.0 400 Bad Request in /home/robsdmr/public_html/fb/index.php on line 34
コードは次のとおりです。
<?php
require_once("src/facebook.php");
$app_id = "xxxxxxxxxx";
$app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";
$canvas_page = "https://apps.facebook.com/roblewtest/" .$app_id;
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,
));
$access_token = $facebook->getAccessToken();
$auth_url = "https://www.facebook.com/dialog/oauth?scope=user_id&client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page);
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {
}
$graph_url = "https://graph.facebook.com/me?fields=id&access_token=" . $access_token;
$result = json_decode(file_get_contents($graph_url));
echo "{$result->id}"
?>
私はこれにかなり新しいので、ポインターは素晴らしいでしょう
私はそれがまったく握っていないスコープであると感じていますが、私は本当にこれが機能する必要があります。
たくさんの人に感謝しますnギャル。
R.
正しい解決策はありません
所属していません StackOverflow