如何使用Facebook的API检查用户是否喜欢我的Facebook页面或URL我想我快疯了。我不能让它起作用。我只想检查用户是否喜欢我的页面,并将javascript放在iFrame阿普。FB.api({
method: "pages.isFan",
page_id: my_page_id,}, function(response) {
console.log(response);
if(response){
alert('You Likey');
} else {
alert('You not Likey :(');
}
});此返回:false但是我网页的粉丝,所以它不应该返回真实吗?!
3 回答
慕妹3146593
TA贡献1820条经验 获得超9个赞
OAuth 2.0
$_REQUEST['signed_request']
function parsePageSignedRequest() { if (isset($_REQUEST['signed_request'])) { $encoded_sig = null; $payload = null; list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2); $sig = base64_decode(strtr($encoded_sig, '-_', '+/')); $data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true)); return $data; } return false; } if($signed_request = parsePageSignedRequest()) { if($signed_request->page->liked) { echo "This content is for Fans only!"; } else { echo "Please click on the Like button to view this tab!"; } }
添加回答
举报
0/150
提交
取消