skip to Main Content

I used following code to access facebook page posts.

$accessToken = 'EAAlGssgdgQIBAHuD9ZBZB6RWZClM3bmm8Vjv2nZBNmotTTnubgzdK4aiHbqJwhRlELjAurPEHKSqxJS7c0Pyd5ZBuqZAo2keabbkubx0AZCl3m6brDGlkXNgMq9dtNUZAx4P6QwdsXwNvJaEi2j3YDsHpZABiRxRK6qMAmZAyynLvJNCJ41ZBn9se28QUsDHG72mhZCzHFLpLQUxZCAZDZD';
$id = '109395947376896';
$url = "https://graph.facebook.com/$id/posts?access_token=$accessToken";
$result = file_get_contents($url);
$decoded = json_decode($result, true);
var_dump($decoded);

and get the following result. screenshot is attached

enter image description here

how do I get images of posts??

2

Answers


  1. Without specifying the fields, you will only get default ones. This is how you can get fields (checkout the API docs for Posts about available ones):

    $url = "https://graph.facebook.com/$id/posts?access_token=$accessToken&fields=full_picture,message,...";
    

    Source: https://developers.facebook.com/docs/graph-api/reference/post/#fields

    Login or Signup to reply.
  2. You can get them in field parameters

    • picture
    • full_picture
    • child_attachments

    Also refer https://developers.facebook.com/docs/graph-api/reference/post/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search