Feed中的共享配置文件链接在JSON图API API中没有足够的数据

时间:2016-02-26 03:13:04

标签: php arrays json facebook facebook-graph-api

我想知道是否有办法显示页面Feed上已共享的实际个人资料。现在,返回的字段不会提供太多信息。

我将feed作为json对象抓取,使用json_decode将其转换为php变量并迭代返回的数组。

除非有人链接到Feed中网页的个人资料,否则一切正常。

$fields = "id,message,picture,full_picture,link,name,description,type,icon,created_time,from,object_id,source";

https://graph.facebook.com/{$fb_page_id}/feed?access_token={$access_token}&fields={$fields}

常规数据项:

[2] => Array
    (
        [id] => 12312452343463463_31253215252
        [message] => Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
        [picture] => https://www.picture.com/ADSASD1223
        [full_picture] => https://www.picture.com/ADSASD1223_full
        [link] => http://www.link.com/
        [name] => Linkage
        [description] => Linkage is a link provider
        [type] => link
        [icon] => https://www.facebook.com/images/icons/post.gif
        [created_time] => 2016-02-23T16:07:05+0000
        [from] => Array
            (
                [name] => Test
                [id] => 1233434564567
            )

    )

个人资料数据项:

[3] => Array
    (
        [id] => 31248734871234_312498341278341278
        [message] => Look!  It's John the Deer! Make sure to follow him!
        [type] => status
        [created_time] => 2016-02-21T19:16:24+0000
        [from] => Array
            (
                [name] => Test
                [id] => 1343143414314314
            )

    )

正如您所看到的,实际链接的个人资料没有链接或没有图像。

1 个答案:

答案 0 :(得分:0)

感谢CBroe's suggestion我从特定帖子中获取了ID并尝试了post对象的所有字段。

字段story_tags最终成为了那个。

返回以下内容:

"story_tags": [ { "id": "0909030339039", "name": "Name of the person or page that shared the profile", "type": "page", "offset": 0, "length": 23 }, { "id": "91238193129", "name": "Shared Profile Name", "type": "user", "offset": 33, "length": 7 }

我不确定偏移量和长度是指什么,但是我最终可以看到并且可以访问共享配置文件的id值。