我有两个功能。在我自己的墙上张贴,没有错误。
现在我对小组帖子中的第二个功能感到沮丧.. 不幸的是,到目前为止还没有成功。
功能2给我假回复作为回应。
我的范围 user_groups,publish_actions,电子邮件,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
}
}
答案 0 :(得分:0)
创建应用程序时,您需要拥有“friends_groups”和“offline_access”的朋友的群组访问权限。
查看