且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Facebook图表api需要一个页面的照片?

更新时间:2022-05-22 00:31:51

有时你不幸遇到使用FQL调用来获取这种类型的信息。 Facebook与页面数据的处理方式有很大的不一致性 - 我不会理解这些内容,但您可以在这里找到您想要做的内容:如何使用Facebook图表API来检索风扇照片上传到墙壁的风扇页面?

Sometimes you're unfortunately stuck using FQL calls to get this type of information. Facebook has a lot of inconsistencies with how page data is handled -- I won't get into these, but what you're looking to do can be found here: How to use Facebook graph API to retrieve fan photos uploaded to wall of fan page?

这是一个PHP示例:

    $photoQuery = urlencode('SELECT pid,owner,src_small,src_big FROM photo WHERE aid IN ( SELECT aid  FROM album  WHERE owner = your_page_id)');    
    $photoFQL = 'https://api.facebook.com/method/fql.query?query='.$photoQuery .'&access_token='.$accessToken.'&format=json';   
    $photoResults = file_get_contents($photoFQL);

你最终会得到一个你可以测试的URL:

You'll end up with a url like this you can test with:

https://api.facebook.com/method/fql.query?query = SELECT%20pid%2Cowner%2Csrc_small%2Csrc_big%20FROM%20photo%20WHERE%20aid%20英寸20%(%20SELECT%20aid%20%20FROM%20album%20%20WHERE%20owner%20%3D% {PAGE_ID })& access_token = {access_token}& format = json

https://api.facebook.com/method/fql.query?query=SELECT%20pid%2Cowner%2Csrc_small%2Csrc_big%20FROM%20photo%20WHERE%20aid%20IN%20(%20SELECT%20aid%20%20FROM%20album%20%20WHERE%20owner%20%3D%{page_id})&access_token={access_token}&format=json

当然,用你自己的代替{page_id}和{access_token}在JSON响应中显示了我的社区/粉丝专页的照片,祝你好运。

Replacing the {page_id} and {access_token} with your own, of course. I tested this and it showed my Community/Fan Page's photos in a JSON response. Good luck.