1

有人能帮帮我吗?我尝试在我的组中的帐户(我是组的管理员)上发帖。(如图)

我有两个功能。在我自己的墙上张贴,没有错误。

现在我在小组帖子中使用第二个功能.. 不幸的是,到目前为止还没有成功。

功能 2 给我错误的回应。

我的范围 user_groups、publish_actions、email、read_stream、publish_stream、user_photos、friends_photos、manage_pages

    function PostMessage(){

    $postString = 'message='.rawurlencode($this->getMessage()).'&uid='.$this->getUId().'&attachment='.urlencode($this->getAttachment()).'&'.$this->getAccessToken();

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "https://api.facebook.com/method/stream.publish");

    curl_setopt($curl, CURLOPT_FAILONERROR, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
    $response = curl_exec($curl);
    //print_r($response);
    curl_close($curl);

}




function PostGroupMessage(){

    $postString = 'message='.rawurlencode($this->getMessage()).'&uid='.$this->getUId().'&attachment='.urlencode($this->getAttachment()).'&'.$this->getAccessToken();


    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "https://graph.facebook.com/".$this->getGroupId()."/feed");  // Neither group name nor the groups function id 

    curl_setopt($curl, CURLOPT_FAILONERROR, 1);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $postString);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 
    $response = curl_exec($curl);
    curl_close($curl);

}

编辑:

这是我发布运行之前对象的转储:

object(fb_send)#1 (6) {
  ["m_AppId":"fb_send":private]=>
  string(15) "xxxx"
  ["m_SecretId":"fb_send":private]=>
  string(32) "xxxx"
  ["m_UId":"fb_send":private]=>
  int(xxxx)
  ["m_AccessToken":"fb_send":private]=>
  string(56) "access_token=xxxx"
  ["m_Message":"fb_send":private]=>
  string(101) "Besuchen Sie www.modelweb24.de - Die neue kostenlose social community für Fotografen und Fotomodelle!"
  ["m_Attachment":"fb_send":private]=>
  string(258) "{"href":"http://www.modelweb24.de","name":"Wir begrüßen ","caption":"","description":"auf www.modelweb24.de","media":[{"type":"image","src":"http://www.modelweb24.de/ow_static/themes/OWD-Nyx/images/logofb.png","href":"http://www.modelweb24.de/"}]}"
}

然后我做 PostGroupMessage() 并且 $response 是 bool(false)。没有更多的错误

编辑2:

https://graph.facebook.com/180243765369952/feed/?access_token=xxxxx在群墙上给我所有新闻

编辑3:

我已经发送了参数 ?method=POST ,现在我变成了一个错误。我缺少什么许可?

{
   "error": {
      "message": "(#200) The user hasn't authorized the application to perform this action",
      "type": "OAuthException",
      "code": 200
   }
}
4

1 回答 1

0

在创建应用程序时,您都需要对您的朋友具有组访问权限,即“friends_groups”和“offline_access”。

您可以在https://developers.facebook.com/tools/explorer查看

于 2013-02-27T10:38:13.733 回答