내 데이터베이스에 페이스 북 그래프의 데이터를 저장하려고합니다. 내 버그가 페이 스북 부분이나 PHP 부분에 있는지 잘 모르겠습니다.페이 스북 그래프 응용 프로그램에서 요청한대로 데이터가 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']로 바꾸었지만 여전히 작동하지 않습니다. –