Here are my codes, I want to get access token after user login, but I don't know where am I wrong guys.
I know to get access token in PHP SDK v4 but I think It's quite different in PHP SDK v5. Please help me
guys
<?php
session_start();
require_once("Facebook/autoload.php");
use Facebook\Facebook;
use Facebook\FacebookResponse;
use Facebook\GraphNodes\GraphNode;
use Facebook\Helpers\FacebookRedirectLoginHelper;
use Facebook\Exceptions\FacebookSDKException;
use Facebook\Exceptions\FacebookResponseException;
$api_id="1";
$api_secret="2";
$url="http://localhost:80/feedreader/fdposter.php";
$fb = new Facebook([
"app_id" => $api_id,
"app_secret" => $api_secret,
"default_graph_version" => "v2.2",
]);
$helper=$fb->getRedirectLoginHelper();
try{
$token=$helper->getAccessToken();
if(isset($token))
{
echo "Successfully......";
}
else{
$permision=array("scope"=>"email");
echo "<a href='".$helper->getLoginUrl($url,$permision)."'>Click to post</a>";
}
}
catch (Facebook\Exceptions\FacebookSDKException $e)
{
echo $e->getMessage();
}
?>
Below is the message that I get after running the code
!