How to detect Facebook Like button pressed and trigger event?

后端 未结 5 603
借酒劲吻你
借酒劲吻你 2021-02-06 16:01

Here is the example:

  • http://www.facebook.com/UEvents?v=app_4949752878&ref=ts

These guys get people to click on Like button (in Step 1) first bef

5条回答
  •  囚心锁ツ
    2021-02-06 16:44

    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'];
    

    Now FB is on the way of deprecating FBML so don't consider as something that will work for a long base.

提交回复
热议问题