/v2.1/{post-id} does not deliver photos

I know this question asked server times, but I could not find a solution from other posts:

My goal is to read the facebook feed from one of my facebook sites! There are several posts with several photos on this site.

In the first call that you see, I always get only one photo, but I need all of them. To do this, I make a secound request, which should give me all the information for this message if I use v2.1, which I modify in FacebookRequest.php

Here is my code:

FacebookSession::setDefaultApplication('yyy','xxxxx'); $session = new FacebookSession('yyy|xxxxx'); $url = '/{pageid}/feed'; $request = new FacebookRequest($session, 'GET', $url); $response = $request->execute(); graphObject = $response->getGraphObject(); $rawFeed = $graphObject->asArray(); foreach($rawFeed['data'] as $item) { $x = explode('_',$item->id); $url = "/".$x[0]; $request = new FacebookRequest($session, 'GET', $url); $response = $request->execute(); $graphObject = $response->getGraphObject(); $object = $graphObject->asArray(); echo "<pre>";var_dump($object);echo "<pre>"; } 

If I use this code, I always get an error:

 Fatal error: Uncaught exception 'Facebook\FacebookAuthorizationException' with message '(#100) Requires user session' 

Why does the first query return data back, and scound is an exception!

Change 1

Found a solution to the session problem ( Facebook token for pages ) - (top answer), but still a problem with the photo:

Now I am returning data from Facebook, but I do not receive attached photos to the message!

This is how I no longer get authentication issues

 $accessToken = "{accestToken from GRAPH API EXPLORER}"; $session = new FacebookSession($accessToken); $url = "/{myPersonalFB-ID}/accounts"; $request = new FacebookRequest($session, 'GET', $url); $response = $request->execute(); $graphObject = $response->getGraphObject(); $pages = $graphObject->asArray(); $pageAccesstoken = false; foreach($pages['data'] as $page) { if($page->id != "{MyPageID}") continue; else { $pageAccesstoken = $page->access_token; } } $session = new FacebookSession($pageAccesstoken); $url = '/{MyPageID}/feed'; ... ... 
+1
php facebook facebook-graph-api photos
source share
2 answers

If you need an application session, use the following instead:

 $session = FacebookSession::newAppSession(); 

You can then pass this application session to your API call to get the page feed.

0
source share

This seems to be a bug on Facebook. My colleague opened the question. Here's the link: https://developers.facebook.com/bugs/762280800482269/ You can also find the information here: https://developers.facebook.com/bugs/790976317600139/ I hope this helps you.

0
source share

All Articles