Facebook离线贴墙



我确实有网站的餐厅,其中有facebook注册模块的用户注册。我的网站有两种用户,一种是普通注册用户,另一种是Facebook注册用户。到目前为止,这似乎是正确的。在网站上,所有用户都可以发表自己对酒店、收藏等的评论。

我需要通过使用那里的Fb详细信息(Fbid),我已经存储在我的数据库自动分享评论,喜欢和收藏到Facebook网站的用户Facebook墙的方式。每个评论都需要使用他/她自己的FB id发布到FB墙上,而不需要FB登录。是否有任何php-Facebook插件/JSSDK来满足这一要求?

我使用了以下几行库代码,但是现在什么也没发生。

require_once 'facebook.php';
$api_key = 'yyyyyyyyyyyyyyyyyyy';
$secret = 'xxxxxxxxxxxxxxxxxxxx';
$name = 'Publish feed code example';
$id='100001948358224';
$name_href = 'http://forum.developers.facebook.com/viewtopic.php?id=44721';
$caption = 'A simple code caption text';
$description = 'The new Facebook.streamPublish code to pop up a publish feed form';
$img_1 = 'http://www.applications.junkieyard.com/fbfgsfy/images/smileys/smiley-09-05.png';
$img_1_href = 'http://apps.facebook.com/fbfgsfy/profile.php';
$action_links_text = 'Facebook?';
$action_links_href = 'http://www.facebook.com/';
$attachment = array('name' => $name, 'href' => $name_href, 'caption' => $caption, 'description' => $description, 'media' => array(array('type' => 'image', 'src' => $img_1, 'href' => $img_1_href)));
$action_links = array(array('text' => $action_links_text, 'href' => $action_links_href));
if ($id) {
    $target_id = $id;
    ?>
    <script>
        var message = "";
        var attachment = <?=json_encode($attachment)?>;
        var action_links = <?=json_encode($action_links)?>;
        var target_id = <?=$target_id?>;
        alert(Facebook.streamPublish(message, attachment, action_links, target_id));
    </script>
    <?php
}

?>

offline_access在facebook中不再使用,新的方法是通过新端点设置TOKEN的过期时间详见https://developers.facebook.com/roadmap/offline-access-removal/

您需要向用户请求publish_streamoffline_access权限,以便在会话未激活时在其墙上发布。

以编程方式在他们的墙上发布,使用FB.ui的feed方法

FB.ui(
    {
        method: 'feed',
        name: 'Restaurant App',
        link: 'http://apps.facebook.com/yourapp',
        caption: 'Check out my review',
        description: 'The most awesome restaurant ever.',
        message: 'Check out this awesome app'
    },
    function(response) {
        console.log(response);
        console.log(response.post_id);
        if (response && response.post_id) {
            console.log('Post was published.');
        } else {
            console.log('Post was not published.');
        }
    }
    );

要查看上述代码的实际效果,请查看演示应用程序FBRell

最新更新