2012-09-07 84 views
0

我有一些特殊的功能,可以向用戶發送關於我的服務的信息,那裏有很多可以檢測到「Like」的腳本,然後我們可以爲用戶解鎖一些功能(喜歡解鎖),但我希望用戶發表帖子,然後解鎖該功能,而不僅僅是喜歡。在facebook上解鎖解鎖

用我的FB喜歡按鈕,它喜歡它後,它會自動打開一個小窗口,所以他們可以發佈的東西,我怎麼可以檢測POSTS,而不僅僅是像?

感謝

回答

1

,但我想用戶的帖子後,然後解鎖功能

這將是Facebook Platform Policies違反:

IV。應用程序集成點,

1.)您不得激勵用戶使用(或關閉使用Facebook社交頻道的內容),或者暗示激勵與使用我們的頻道直接相關。

+0

但爲什麼有很多腳本可以做Facebook的「喜歡」這樣的功能?看到這個:http://codecanyon.net/item/facebook-like-locker-for-jquery/2303230?sso?WT.ac=search_item&WT.seg_1=search_item&WT.z_author=TylerQuinn – behz4d

+1

他們認爲「社交頻道」是鏈接到此頁面上的進一步解釋,https://developers.facebook.com/policy/#Facebook_social_channels使用「like」來關閉內容被Facebook接受;使用其他渠道 - 就像你打算做的那樣,通過在牆上放置一個_required post_背後的內容 - __不是.__ – CBroe

+0

但並非不可能,對吧?因爲我問過一位曾經與FB API合作過的程序員,他說這完全有可能...... – behz4d

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。

+1

所以你不確定?如果你不確定它是否可以改編,那麼你不應該把它作爲答案。 – Ren