Facebook Graph API PHP对页面上的帖子发表评论作为页面

Facebook Graph API PHP对页面上的帖子发表评论作为页面

问题描述:

I'm using below code to post to my facebook page as page

$post_id = $facebook->api("/$page_id/feed","post",$args);

I want to make a comment to the post I created. I don't know how to do that exactly. But based on some research, I tried below code and it didn't work.

$comment_id = $facebook->api("/$post_id/comments?message='This is m message'");

An echo or print_r for $comment_id doesn't return anything.

How can I accomplish it i.e. posting comment to a post on my Facebook page using Facebook graph API for PHP? Kindly guide me in the right direction.

Try something like this,

$facebook ->api('/'.$post_id.'/comments', 
 'post', 
    array(
      'access_token' => $your_access_token_variable,
      'message' => 'Your message',
    )
);