可以获取到id和昵称
<?php
$code = $_GET['code'];
$APP_ID = '521154724729510';
$APP_Secret = 'f0653b91226ea43f7733a52866e942d1';
$DOMAIN = 'www.shanheweb.cn';
$CALL_BACK = '/fblogin.php';
if (isset($code) && ($code != '')) {
$data = array();
$token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=".$APP_ID."&redirect_uri=http://" . $DOMAIN . $CALL_BACK."&client_secret=".$APP_Secret."&code=" . $code;
$user_token = file_get_contents($token_url);
$data1 = explode('access_token=', $user_token);
$data2 = explode('&expires=', $data1[1]);
$graph_url = "https://graph.facebook.com/me?access_token=" . $data2[0];
$user = file_get_contents($graph_url);
echo $user;
} else {
$url = "https://www.facebook.com/dialog/oauth?app_id=".$APP_ID."&client_id=".$APP_ID."&display=page&domain=" . $DOMAIN . "&locale=en_US&origin=1&redirect_uri=http://" . $DOMAIN . $CALL_BACK."&response_type=code";
header("Location: " . $url);
}