/ Published in: PHP
Show and hide content based on whether or not a user has clicked the 'Like' button of an app.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// THE 'facebook.php' FILE CAN BE FOUND ON Github (https://github.com/facebook/php-sdk) // YOU NEED A COPY OF ALL FILES IN THE 'src' FOLDER ON Github AS PART OF YOUR PROJECT // THEN YOU ONLY NEED TO INCLUDE ONE FILE INTO YOUR PHP CODE...AS PER BELOW require 'incl/facebook.php'; $app_id = "YOUR APP ID"; $app_secret = "YOUR APP SECRET"; 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true )); $signed_request = $facebook->getSignedRequest(); $like_status = $signed_request["page"]["liked"]; if($like_status){ exit; }else{ echo 'You Dont Like this'; }