2013-02-26 77 views
1

能帮帮我吗? 我尝试在我的团队(我是该团队的管理员)的帐户上发帖。 (如图)facebook上的api图贴在墙上

我有两个功能。在我自己的墙上张贴,无误地工作。

现在我在群发帖子的第二个功能.. 不幸的是,迄今没有成功。

函数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:

我有送参数法= POST,现在我成为了一个错误? 我缺少什么权限?

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

查看是否有API错误? – Igy 2013-02-26 15:37:54

+0

我已经编辑我的帖子 – 2013-02-26 15:54:16

+0

我已经发送了参数?method = POST,现在我成了一个错误。我缺少什么许可? { “错误”:{ “消息”: “(#200)的用户没有被授权执行该动作的应用”, “类型”: “OAuthException”, “代码”:200 } } – 2013-02-26 16:45:15

回答