Logo Questions Linux Laravel Mysql Ubuntu Git Menu

Facebook Graph API POST to a comment to a Stream object

I'm trying to post a comment to a status post on facebook. I've figured out how to "like" existing comments using the following code:

$status = $facebook->api("/$id/likes", 'post');

How would I modify the code to post a comment to this status message instead of like.

I've tried this: $status = $facebook->api("/$id/stream", 'post', "$comment");

but it returns this error: Invalid argument supplied for foreach()

I've also used "/$id/comments" instead of "/$id/stream", same error.

like image 340
Bill Masters Avatar asked Feb 26 '23 11:02

Bill Masters

1 Answers

$facebook->api('/'.$POST_ID.'/comments','post',array('message' => $comment)); works for me. Make sure that you have publish_stream permissions and that you provide a proper Post ID of the status message.

like image 72
Bartek Avatar answered Apr 08 '23 18:04