2011-03-19 94 views
1

我正在創建一個Facebook應用程序。我管理了一個擴展的發佈流應用程序。我想在用戶的牆上顯示應用程序結果。做下面的方法,它會自動發佈在用戶的牆上,我想通過發佈/跳過對話框來完成。任何人都可以幫助我。非常感謝!!Facebook的應用程序發佈在用戶的牆上的權限(發佈/跳過)php sdk

 $facebook->api('/me/feed', 'post', array(
     'message' => message, 
     'name' => $fbme['first_name'], 
     'description' => 'here goes description', 
     'caption' => 'this is caption', 
     'picture' => $imageurl, 
     'link' => 'some link here', 

//下一部分,邀請好友。我想當用戶點擊發布/只跳過一個對話窗口apper請求邀請朋友。我嘗試這種方式,但它不起作用。

function(response) { 
if (response && response.post_id) { 
    alert('Post was published.'); 
    '<?php echo("invitefriends.php")' 
} else { 
    alert('Post was not published.'); 
    '<?php echo("invitefriends.php")' 
} 

我遇到的問題是我得到三個窗口,並同時他們所有人。 invitefriends.php具有與javascript sdk示例中提到的相同的代碼,並且它工作正常。

讓我知道在哪裏以及如何包含invitefriends.php。

謝謝!!

回答

3

你應該使用FB.ui

FB.ui(
    { 
    method: 'feed', 
    name: 'Facebook Dialogs', 
    link: 'http://developers.facebook.com/docs/reference/dialogs/', 
    picture: 'http://fbrell.com/f8.jpg', 
    caption: 'Reference Documentation', 
    description: 'Dialogs provide a simple, consistent interface for applications to interface with users.', 
    message: 'Facebook Dialogs are easy!' 
    }, 
    function(response) { 
    if (response && response.post_id) { 
     alert('Post was published.'); 
    } else { 
     alert('Post was not published.'); 
    } 
    } 
); 

爲了驗證這一點,到了Test Console - >點擊 - >然後從fb.ui列表選擇飼料

+0

謝謝ifaour,我已經在fb文檔中看到了這個,並且已經實現了它,但問題是:我的所有消息都不相同。即他們從mysql表中獲取數據作爲php變量。所以我對不同的消息有不同的圖像。說在fetchdata.php我從MySQL表中獲得的URL。說我更新的狀態了。statusupdate.php ......當我寫**圖片:$ IMAGEURL ** ......它顯示了一個錯誤,它會爲所有PARAMS即鏈接,消息等希望你得到了我的問題。 thnx! – 2011-03-19 22:46:35

+0

@RahulSharma:你能提供給你錯誤的代碼嗎?你也知道你應該使用'picture:'<?php echo $ imageurl; ?>','對嗎? – ifaour 2011-03-19 22:59:03

+0

thnx人。我在添加額外報價時犯了一個愚蠢的錯誤。只是一個問題,看看你的代碼中的變化,這是另一個疑問! - – 2011-03-19 23:28:34

0

我不確定,但你只要我猜你需要訪問令牌在用戶牆上張貼。

$ token = $ facebook-> getAccesstoken();

$facebook->api('/me/feed', 'post', array(
    'message' => message, 
    'name' => $fbme['first_name'], 
    'description' => 'here goes description', 
    'caption' => 'this is caption', 
    'picture' => $imageurl, 
    'link' => 'some link here', 
    'access_token' =>$toekn); 

我希望它

相關問題