I'm trying to make a web application with Facebook using PHP SDK I had not any problems installing and running the PHP SDK This is my login script index.php
<?php
session_start();
$app_id = '***************';
$app_secret = '******************************';
$my_url = 'https://www.domain.net/';
require_once __DIR__ . '/vendor/autoload.php';
$fb = new Facebook\Facebook(['app_id'=>$app_id,'app_secret'=>$app_secret,'default_graph_version'=>'v2.5',]);
$helper = $fb->getRedirectLoginHelper();
if (isset($_SESSION['facebook_access_token'])){
$fb->setDefaultAccessToken($_SESSION['facebook_access_token']);
try {
$fbresponse = $fb->get('/me');
$fbuserNode = $fbresponse->getGraphUser();
} catch(Exception $e) {
error_log("index.php: Exception",0);
$permissions = ['email'/*, 'user_likes'*/];
$loginUrl = $helper->getLoginUrl('https://www.sofiariders.net/fblog-callback.php', $permissions);
echo '<a href="' . $loginUrl . '">Log in with Facebook!</a>';
exit;
}
?>
It works perfectlyq i'm getting logged in with the facebook but the problem is - the ID of my profile. From the $fbuserNode->getId() i'm getting the id 140261546352183 And Facebook doesn't open my profile by the URL https://www.facebook.com/profile.php?id=140261546352183
For example by using the site findmyfbid.com i'm getting another ID for the same profile - it's 100011050158477 and with that id Facebook successfully opens the URL https://www.facebook.com/profile.php?id=100011050158477
The question is - how can I cat my normal profile ID with the PHP SDK? And why i'm getting wrong id?