I have to parse comments from facebook page. I have stored data in $graphObject
but it does not parse data through it and returns following errors
Notice: Undefined variable: session in C:\xampp\htdocs\facebook\index.php on line 92
Fatal error: Call to undefined method Facebook\FacebookRequest::execute() in C:\xampp\htdocs\facebook\index.php on line 97
Here is the code
require_once __DIR__ . '/path/to/php-graph-sdk-5.0.0/src/Facebook/autoload.php';
include('path/to/php-graph-sdk-5.0.0/src/Facebook/FacebookRequest.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/FacebookApp.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/FacebookBatchRequest.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/FacebookClient.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/SignedRequest.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/Authentication/AccessToken.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/Facebook.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/GraphNodes/GraphUser.php');
include('path/to/php-graph-sdk-5.0.0/src/Facebook/GraphNodes/GraphObject.php');
use Facebook\FacebookRequest;
use Facebook\Facebook;
$request = new FacebookRequest(
$session,
'GET',
'/{page_id}_{post_id}/comments'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
I am unaware about which library is needed here. Kindly help