从 Facebook 对话中获取数据 api

getting data from facebook conversation api

我最近使用了来自 facebook 的图表 api,它太棒了,当我试图在我的页面上获取对话数据时它起作用了,但它给了我一个对象,我尝试使用 print_r 看起来像这样

try {
// Get the \Facebook\GraphNodes\GraphUser object for the current user.
// If you provided a 'default_access_token', the '{access-token}' is optional.
    $response = $fb->get('me/conversations?fields=name,messages{from,attachments{file_url,name,size},to,message,sticker},subject');

//    $response = (array) $response;

    print_r($response);
} catch(\Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
    echo 'Graph returned an error: ' . $e->getMessage();
    exit;
} catch(\Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
    echo 'Facebook SDK returned an error: ' . $e->getMessage();
    exit;
}

所以现在我尝试了很多次数据,我不想要所有这些数据,我只想要请求的主体,这样我就可以获取一个对象然后正常访问它,我该怎么做

对不起,我知道怎么做了,就像这样

$response = $fb->get('me/conversations?fields=messages{to,message,sticker,from}');

将会

$response = $fb->get('me/conversations?fields=messages{to,message,sticker,from}')->getdecodedBody();