私はFacebookのグラフからデータをmy dbに保存しようとしています。バグがfacebookの部分か、phpの部分か分かりません。Facebookのグラフアプリケーションで要求されたデータがdbに保存されていません
コードを実行すると、画面に何も表示されません。エラーメッセージは表示されず、他の場所への転送(ヘッダ経由)もなく、データはdbに保存されません。添付
はコードです:
if ($cookie)
{
$user = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$cookie['access_token']),true);
if ($user)
{
// Connect to database
mysql_connect('localhost', 'xxxxx', 'xxxxxx');
mysql_select_db('xxxxx');
$result = mysql_query("INSERT INTO users (xxxx, xxxx) VALUES ('".$user['data']['id']."', '"$user['data']['name']."');");
if ($result)
{
// If User successfully stored - redirect to update or post on Facebook wall
header("Location: http://xxxxxxx.com/xxxxxxx.php");
exit;
}
else
{
// If Error in storing
echo '$result is empty';
}
}
else
{
// If error in parsing
echo '$user is empty';
}
}
else
{
// If error in authentication status
echo '$cookie is empty';
}
誰もが任意のアイデアを持っていますか?
本当ですか?私は "me"を$ cookie ['uid']に置き換えましたが、それでも動作しません。 –