在脸书上发帖解锁


Post on facebook to unlock

我为那些向他们的Facebook发送关于我的服务的帖子的用户提供了一些特殊功能,有很多脚本可以检测到"点赞",然后我们可以为用户解锁一些功能(点赞解锁),但我希望用户发布帖子,然后解锁该功能,而不仅仅是点赞。

有了我的FB点赞按钮,点赞后,它会自动打开一个小窗口,这样他们就可以发布一些东西,我如何检测帖子而不仅仅是点赞?

感谢

但我希望用户张贴一个帖子,然后解锁功能

这将违反Facebook平台政策:

IV。应用程序集成点,

1.)您不得激励用户使用(或屏蔽使用背后的内容)Facebook社交渠道,或暗示激励与我们渠道的使用直接相关。

<?php
session_start(); //start PHP session
session_regenerate_id(true); //Generated new session id
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Project</title>
<script type="text/javascript" src="js/jquery.js"></script>
</head>
<body>
<div id="tweet_content" class="locked_ct"><h5>Tweet to Unlock this Content</h5>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="saaraan">Tweet</a>
</div>
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
<script type="text/javascript">
//All event bindings must be wrapped within callback function
twttr.ready(function (twttr) {
    //######## trigger when the user publishes his tweet
    twttr.events.bind('tweet', function(event) {
        /*
        To make locked items little more private, let's send our base64 encoded session key
        which will work as key in send_resources.php to acquire locked items.
        */
        var data = {unlock_key : '<?php echo base64_encode(session_id());?>'};
        //Load data from the server using a HTTP POST request.
        $.post("send_resources.php", data, function(data)
        {
            //Append unlocked content into div element
            $('#tweet_content').html(data);
        }).error(function(xhr, ajaxOptions, thrownError) {
            //Output any errors from server.
            alert( thrownError);
        });
    });
});
</script>
</body>
</html>



<?php
session_start(); // session start
//retrive base64 encoded post variable and compare it with session id.
if (isset($_POST["unlock_key"]) && base64_decode($_POST["unlock_key"])===session_id())
{
    //user unlocked item by tweeting.
    echo "Congratulations! You just unlocked this text by Tweeting!";
}else{
    //Output HTTP errors
    header('HTTP/1.1 500 Oops! something went wrong...');
    exit();
}
?>

这是推特的,但它可能可以适应脸书。