如何检测Facebook Like按钮被按下并触发事件? [英] How to detect Facebook Like button pressed and trigger event?

查看:83
本文介绍了如何检测Facebook Like按钮被按下并触发事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是示例:

在让用户在步骤2中下载视频之前,这些家伙先让人们点击了赞"按钮(在步骤1中).

These guys get people to click on Like button (in Step 1) first before letting the user download the video in Step 2.

有趣的是,在步骤2中检测到赞"按钮,页面刷新以显示模糊的图像,因此用户可以单击下载.

Interestingly, the Like button was detected and the page refreshed to show the blurred out image in Step 2 so user can click through to download.

似乎还记得我单击了赞"(当我重新加载页面时),所以赞"按钮不再显示,它仅显示第2步.

And it seems to remember that I click on Like (when I reload the page) so the Like button does not show any more and it just only shows Step 2.

他们的交易技巧是什么?

What is their trick of the trade?

推荐答案

已签名请求中是否包含用户是页面迷的实际信息.由于您首先需要像下面这样对签名的请求进行解码:

Actually information if user is page fan or not exists in signed request. Since you need firstly to decode signed request like it is here:

 $signed_request = $_REQUEST["signed_request"];
 list($encoded_sig, $payload) = explode('.', $signed_request, 2); 
 $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

在该访问页面之后,喜欢了变量:

And after that access page liked variable:

$pageLiked = $data['page']['liked'];

现在FB即将淘汰FBML,因此不要将<fb:visible-to-connection>视为可以长期使用的东西.

Now FB is on the way of deprecating FBML so don't consider <fb:visible-to-connection> as something that will work for a long base.

这篇关于如何检测Facebook Like按钮被按下并触发事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆