can one help me? I try on my account in my group (i´m admin of the group) to post. (as graph)
I have two functions. a posting on my own wall, which works without errors.
Now I woltle with the second function in the group post .. Unfortunately, so far without success.
Function 2 give me false back as response.
My scopes 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);
}
EDIT:
This is a dump from the object before I post the run:
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/"}]}"
}
Then i do PostGroupMessage() and $response is bool(false). No more Errors
EDIT 2:
https://graph.facebook.com/180243765369952/feed/?access_token=xxxxx give me all news on group wall
Edit 3:
i have send the parameter ?method=POST and now i became a error. what permission am I missing?
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException",
"code": 200
}
}
While creating the application you all need to have the group access permission for your friends that is "friends_groups" and "offline_access".
You can check it at https://developers.facebook.com/tools/explorer
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.