2013-02-26 109 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

回答