2011-03-19 95 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); 

我希望它

相关问题