簡體   English   中英

獲取用戶朋友的Facebook帖子,其中包括“ xyz正在感受***”

[英]Get facebook posts of a user's friend, that includes “ xyz is feeling *** ”

我試圖得到一個用戶朋友的帖子,上面寫着“ xyz感到難過”。 問題是我只能得到“ xyz更新了他的身份”。 我正在使用Facebook API在PHP中進行編碼。 這是我項目中的代碼

$accessToken = $this->getNewLongAccessToken($user_id,$user_id);
        $session = $this->getActiveSessionForAccessToken(trim($accessToken));
        if ($session) {
            try {
                $response['feeds'] =  (new FacebookRequest(
                        $session, 'POST', '/?batch='.urlencode(json_encode($posts))
                        ))->execute()->getGraphObject()->asArray();
                        unset($posts);
            } catch (FacebookRequestException $e) {
                //die("Exception occured, code: " . $e->getCode());
                die(" with message: " . $e->getMessage());
            }
        } else {
            die("invalid session ");
        }

    }
    $response['facebook_friends_ids'] = $facebook_friends_ids;

    $users = array();

    if(isset($response['feeds']) && !is_null($response['feeds'])){
        foreach($response['feeds'] as $f){
            if(isset($f->body)){
                $users[] = json_decode($f->body);
            }
        }
    }
    echo print_r($users);
    exit;

這是我的輸出

[1] => stdClass Object
    (
        [data] => Array
            (
                [0] => stdClass Object
                    (
                        [id] => 10204368080380360_10207876135079535
                        [from] => stdClass Object
                            (
                                [name] => XYZ
                                [id] => 10204368080380360
                            )

                        [story] => XYZ updated his status.
                        [story_tags] => stdClass Object
                            (
                                [0] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [id] => 10204368080380360
                                                [name] => XYZ
                                                [type] => user
                                                [offset] => 0
                                                [length] => 16
                                            )

                                    )

                            )

                        [actions] => Array
                            (
                                [0] => stdClass Object
                                    (
                                        [name] => Comment
                                        [link] => https://www.facebook.com/10204368080380360/posts/10207876135079535
                                    )

                                [1] => stdClass Object
                                    (
                                        [name] => Like
                                        [link] => https://www.facebook.com/10204368080380360/posts/10207876135079535
                                    )

                                [2] => stdClass Object
                                    (
                                        [name] => Share
                                        [link] => https://www.facebook.com/10204368080380360/posts/10207876135079535
                                    )

                            )

                        [privacy] => stdClass Object
                            (
                                [value] => 
                                [description] => 
                                [friends] => 
                                [allow] => 
                                [deny] => 
                            )

                        [type] => status
                        [status_type] => mobile_status_update
                        [created_time] => 2015-11-09T11:07:27+0000
                        [updated_time] => 2015-11-10T07:03:21+0000
                        [is_hidden] => 
                        [is_expired] => 
                        [likes] => stdClass Object
                            (
                                [data] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [id] => 10152657992473469
                                                [name] => **********
                                            )

                                        [1] => stdClass Object
                                            (
                                                [id] => 634582776638368
                                                [name] => *************
                                            )

                                    )

                                [paging] => stdClass Object
                                    (
                                        [cursors] => stdClass Object
                                            (
                                                [after] => NjM0NTgyNzc2NjM4MzY4
                                                [before] => MTAxNTI2NTc5OTI0NzM0Njk=
                                            )

                                    )

                            )

因此,總而言之,我有什么辦法可以找出用戶的朋友是否更新了任何“感覺”類型的狀態。 謝謝!

我已經強調了我試圖在這張照片中得到什么

這是Facebook Graph API Explorer的響應

沒有辦法使用facebook graph api來獲取它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM