Hilal2009 0 Programmer

Hey guys, Is there any one who knows how to get a session from access_token? In Facebook PHP SDK v5 I can get access_token, but I don't know how to get a session so as to retrieve feeds. According to Facebook PHP SDK v5 and Graph API v 2.4 documentation(Click Here), session is required to retrieve feeds from a facebook page.

Here below is my codes

<?php
    session_start();
    require_once("Facebook/autoload.php");        
    use Facebook\Facebook;    
    use Facebook\FacebookResponse;
    use Facebook\GraphNodes\GraphNode;
    use Facebook\Helpers\FacebookRedirectLoginHelper;

    class share_counter
    {        
        public function get_feed()
        {
            $api_id="8888090.....";
            $api_secret="6786bdcd97b18e94b9.......";
            $url="http://localhost/feedreader/feeds.php";

            $login=array("app_id"=>$api_id,"app_secret"=>$api_secret,"default_graph_version"=>"v2.2");            
            $fb=new Facebook($login);

            $helper=$fb->getRedirectLoginHelper();
            try{
                $access_token=$helper->getAccessToken();

                $request = new FacebookRequest(
                  $session,
                  'GET',
                  '/{page-id}/feed'
                );
                $response = $request->execute();
                $graphObject = $response->getGraphObject();
            } 
            catch (Exception $ex) 
            {

            }
        }
    }
?>

Please help me guys

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.