Return to Snippet

Revision: 55552
at February 11, 2012 02:40 by the_construct


Updated Code
// 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";
$facebook = new Facebook(array(
    'appId' => $app_id,
    'secret' => $app_secret,
    'cookie' => true
));
	 
$signed_request = $facebook->getSignedRequest();
$like_status = $signed_request["page"]["liked"];
	
if($like_status){
    header('Location: home.php');
    exit;
}else{
    echo 'You Dont Like this';
}

Revision: 55551
at February 11, 2012 02:34 by the_construct


Initial Code
require 'incl/facebook.php';
	 
	$app_id = "316789128373788";
	$app_secret = "54b9e3bdea2cfbc76ff2bc3b0b857741";
	$facebook = new Facebook(array(
		'appId' => $app_id,
		'secret' => $app_secret,
		'cookie' => true
	));
	 
	$signed_request = $facebook->getSignedRequest();
	$like_status = $signed_request["page"]["liked"];
	
	if($like_status){
		header('Location: home.php');
		exit;
	}else{
		echo 'You Dont Like this';
	}

Initial URL

                                

Initial Description
Show and hide content based on whether or not a user has clicked the 'Like' button of an app.

Initial Title
Facebook Fan/Like Gate using PHP

Initial Tags
php

Initial Language
PHP