2017-06-20 85 views
0

我正在使用Facebook圖形API來獲取我的留言板並將這些結果處理到我的數據庫中。我已經能夠讓所有的工作都能正常工作,除非用戶用圖像發表評論時,該圖像網址不會出現在我的結果中,我無法弄清楚我錯過了什麼。下面的圖片指向註釋中有圖片的評論,但未列出。Facebook圖表api數組結果缺少評論圖片

這裏是在PHP我GET調用

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"); 

有誰知道這是爲什麼圖像的URL沒有在我的結果顯示?

圖片在評論看到

enter image description here

無圖像

facebook api graph missing picture in comment

+0

_「有人知道爲什麼圖像url沒有顯示在我的結果中嗎?」 - - 因爲你忽略了要求...?您需要詢問評論的「附件」子字段。 – CBroe

+0

是的,我想出來了,我做出了答案 –

回答

0

我結束了,讓做一個圓滑的方式計算出來圖形API結果通過一次調用來調用Graph API,並獲得我需要的所有結果。我給這裏

Get (Identify) Replies to Comments Using the Graph API

答案隨着使用Graph API調用,你可以做到這一切在一杆這樣賦予所有意見的feed部分,每發表回覆以及所有圖片與每個評論/回覆相關聯。

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