FB Graph API request not working in PHP SDK

Graph API: 2.4
PHP SDK: "facebook / php-sdk-v4": "~ 5.0"

I would like to get detailed information about the page through the PHP and PHP SDK. Using the request:

$response = $fb->get('/' . $sPageID . '?fields=posts', $_SESSION['facebook_access_token']); 

returns messages with a good amount of data. But unfortunately the wrong values ​​are:
The limit of 25 applies here. Therefore, even if one post should have 150, if I do count ($post['likes']) , I get only 25.

So, I tried changing my request and according to the graphical explorer, this seems to work fine: PAGE_ID/posts?fields=likes.limit(100),message,comments,shares,picture,link,type

Now I cannot turn this into my PHP call. I get timeouts and

Fatal error: Throw exception "Facebook \ Exceptions \ FacebookSDKException" with the message "Unable to convert the response from the graph to GraphNode because the response looks like GraphEdge. Try using GraphNodeFactory :: makeGraphEdge () instead ...

Is this possible with a single request in PHP, or do I need to run multiple requests, one for each message?

+5
source share
2 answers

I found this answer , and if, since the end of the point of this request is GraphEdge, try this:

 // Get basic info on the user from Facebook. try { $response = $fb->get('/' . $sPageID . '?fields=posts', $_SESSION['facebook_access_token']); } catch (Facebook\Exceptions\FacebookSDKException $e) { dd($e->getMessage()); } $getGraphEdge = $response->getGraphEdge(); 

Hope this helps you.

Sincerely.

+2
source

Use getGraphList() if you have problems with getGraphEdge() .

0
source

All Articles