我为用户发送了一些特殊功能,向他们的Facebook发送关于我的服务的帖子,那里有很多可以检测“喜欢”的脚本,然后我们可以为用户解锁一些功能(喜欢解锁) ,但我希望用户发帖,然后解锁该功能,而不仅仅是喜欢。
使用我喜欢FB的按钮,喜欢它之后,它会自动打开一个小窗口,这样他们就可以发布一些东西,我怎么能检测到POSTS而不只是喜欢?
由于
答案 0 :(得分:1)
但我希望用户发帖,然后解锁功能
这违反了Facebook Platform Policies:
IV。应用程序集成点,
1。)您不得激励用户使用(或使用Facebook社交渠道背后的内容),或暗示激励与我们渠道的使用直接相关。
答案 1 :(得分:0)
<?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();
}
?>
这是针对Twitter的,但它可能适用于Facebook。