我正在尝试让用户的朋友发帖说“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=
)
)
)
总而言之,有什么方法可以让我知道用户的朋友是否更新了任何“感觉”类型的状态。三江源!
答案 0 :(得分:0)
使用facebook graph api无法获取它。