0

I am using the Facebook Graph API to get my wall posts and process those results into my db. I have been able to get everything working except when a user posts a comment to a post with an image, that image url does not appear in my results and I can't figure out what I am missing. The image below is pointing to the comment that has an image in the comment, but its not listed.

Here is my GET call in php

file_get_contents("https://graph.facebook.com/$get_facebook/feed?access_token=$facebook_accesstoken&client_id=$facebook_appid&client_secret=$facebook_appsecret&metadata=1&fields=id,status_type,created_time,from,message,comments,picture,link,icon,parent");

Does anyone know why that image url is not showing in my results?

Image seen in comment

enter image description here

Graph API results with no image

facebook api graph missing picture in comment

Cesar Bielich
  • 4,754
  • 9
  • 39
  • 81
  • _“Does anyone know why that image url is not showing in my results?”_ - because you neglected to ask for it …? You need to ask for the `attachment` sub field of the comments. – CBroe Jun 21 '17 at 08:25
  • Yeah I figured it out and I made it an answer – Cesar Bielich Jun 21 '17 at 08:35

1 Answers1

0

I ended up figuring it out with a slick way that allows to make the call to the Graph API with one call and get all the results I needed. I gave an answer here

Get (Identify) Replies to Comments Using the Graph API

With using the feed part of the Graph API call you can do it all in one shot like this which gives all the comments, replies with each post as well as all the images associated with each comment/reply.

https://graph.facebook.com/$get_facebook/feed?access_token=$facebook_accesstoken&client_id=$facebook_appid&client_secret=$facebook_appsecret&metadata=1&fields=id,status_type,created_time,from,message,comments{comments{attachment,from,id,message},from,id,message,attachment},picture,link,icon
Cesar Bielich
  • 4,754
  • 9
  • 39
  • 81