// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => 'xxxxx',
'secret' => 'xxxxxx',
'cookie' => true
));
// Get User ID
$user = $facebook->getUser();
// We may or may not have this data based on whether the user is logged in.
//
// If we have a $user id here, it means we know the user is logged into
// Facebook, but we don't know if the access token is valid. An access
// token is invalid if the user logged out of Facebook.
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
// This call will always work since we are fetching public data.
$naitik = $facebook->api('/naitik');
$fb_id =$user_profile['id'];
$dealmember_fbid = $user_profile['id'];
$fb_name =$user_profile['name'];
$fb_first_name =$user_profile['first_name'];
$fb_last_name =$user_profile['last_name'];
$fb_link =$user_profile['link'];
$fb_username =$user_profile['username'];
$fb_gender =$user_profile['gender'];
$contact_email = $user_profile["contact_email"]; //this was a separate permission, remember?
$email = $user_profile["email"]; //this was a separate permission, remember?
echo " fb_id = $fb_id <br>";
echo " dealmember_fbid = $dealmember_fbid <br>";
echo " fb_name = $fb_name <br>";
echo " fb_first_name = $fb_first_name <br>";
echo " fb_last_name = $fb_last_name <br>";
echo " fb_link = $fb_link <br>";
echo " fb_username = $fb_username <br>";
echo " contact_email = $contact_email <br>";
echo " email = $email <br>";
ตรง contact_email กับ email มันไม่แสดงค่าอะไรเลย
ไม่แน่ใจว่า para มันคืออะไร หรือต้อง set ค่าอะไรก่อนหน้านี้หรือเปล่าครับ