[英]How to post to a facebook group wall in offline mode using graph API? (I am a member of group)
[英]facebook api graph post on group wall
一个可以帮助我吗? 我尝试使用我的论坛(我是该论坛的管理员)中的帐户发布。 (如图所示)
我有两个功能。 在我自己的墙上张贴的帖子,可以正常工作。
现在我在小组发帖中扮演第二个角色。.不幸的是,到目前为止没有成功。
函数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
}
}
在创建应用程序时,所有人都需要拥有“ friends_groups”和“ offline_access”这两个朋友的组访问权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.