Implementing the Facebook Like Gate

In the previous example, the 'Facebook PHP SDK' hosted in the Heroku servers was downloaded and used. Now it will be downloaded from GitHub and be included manually. Download the 'Facebook PHP SDK' from GitHub.

facebook php sdk on github

Extract it. We need only facebook.php and base_facebook.php files. Copy them to app directory. Delete all other files in .git folder. Now there should be only 4 files. Add new files to the git repository.

git add facebook.php
git add base_facebook.php

facebook app files

Now edit the index.php file to match our simple like gate requirements. First create a 'Facebook Object'.

require 'facebook.php';

$facebook = new Facebook(array(
'appId' => '405567522824849',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'cookie' => true

Now 'Facebook Object' exists. Objects have methods. Use 'getSignedRequest' method. It contains a value called 'page-liked'. Use it to check whether visitor has already 'liked' the page.

$signed_request = $facebook->getSignedRequest();

if ( $signed_request['page']['liked'] )

Conditionally check the 'liked' state and take further actions.

if ( $signed_request['page']['liked'] ){
   echo 'A fan.';
   echo 'Not a fan yet.';

Now the 'index.php' file should look like this.

require 'facebook.php';

$facebook = new Facebook(array(
'appId' => '405567522824849',
'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
, 'cookie' => true

$signed_request = $facebook->getSignedRequest();

if ( $signed_request['page']['liked'] )
   echo 'A fan.';
   echo 'Not a fan yet.';

facebook app index file

If one has not liked the page yet, it displays 'Not a fan'.

not a fan yet

After the one liked the page. It displays 'A fan'.

a liked facebook fan

Visit app integrated page tab below.

Try It Yourself!

Have a look at the other parts of this tutorial.

Part 1: Simple Facebook Like Gate with Heroku Hosting
Part 2: Developing and Deploying with Heroku
Part 3: Implementing the Facebook Like Gate

Add Flexible Layout

This was the second project for Mr. Brant. This project was about making a website iPhone and iPad responsive.

add flexible layout

I completed this project on time. i.e. within 5 days.

responsive wordpress themes

I received a positive feedback from Mr. Brant for this project.

completed a responsive theme

Update WordPress Design

This project was about updating an existing WordPress website. The layout needed to be updated to be responsive. I used CSS3 media queries to implement the responsiveness.
The project poster was Mr. Brant.
This project took 3 weeks to complete. However I was able to do the project successfully.
The following is the project feedback.

Simple Data Entry Project Gone Wrong on

I should say upfront that neither I was awarded this data entry project nor I had a reply to my last message to the project poster. Ever since I bid on this particular data entry project, I was wondering how would I be able to do the data entry work in my free time and earn money.

The following was project description page on I bid on this project for $100USD.

data entry project description

I asked the project poster the typical "how should I proceed?" question. To my surprise I received a lengthy message in reply. The following is the complete message.


Follow Steps To start work::

Step 1:
Go to this site:

Step 2:
Enter User ID and Pass:
User Id : Ridoy132
pass : 12345

Step 3:
==>> After entering to the site Click on 'grapimage'
==>> Then image/code will come and you have to type it simultaneously one by one
==>> Please type 100% correctly(Try your level best) AND USE ALL SMALL LETTER
==>> If you type too many wrong entry then you account will be suspended and no payment will be given
==>> please work honestly and correctly

Step 4:
==>>Rate and payment method:
==>>Rate 1000correct entry= $10
==>>Payment method: paypal/moneybookers/gaf
==>>I will pay you after every 5000 entry completed

Step 5:
Working hours:
==>>Night time is the best time to work
==>>working time is 6pm to 3am(GMT+0)
==>>Only work during this time

==>>So Start work right now and try your level best to do more and more entry daily

With Best regards

Then I asked him whether he would be able to award me the project and create the initial milestone. He asked for my email address and convinced me that he would pay the amount directly to my PayPal account once the project start to progress. I agreed to him; otherwise I will have to pay 20% to too.

I logged onto the 'Data Entry System'. The following shows how it looks like.

simple data entry project

Even-though It was supposed to display an image each and every time "Grab Image" button, Images did not show up that way. It was actually a very tedious task. Sometimes one has to wait 10-15 minutes to image to appear. However I spent a couple of hours doing this simple(!not that simple) data entry work. But I didn't receive the payment on PayPal as promised. I have asked several times about the payment. But no reply received so far!.

The message: Don't work on project if,
1. The project is still open (Not awarded to you).
2. Initial milestone is not created.

Eventhough is the best freelancer site (a.k.a. best outsourcing site) in the world, people like the above project poster try to tarnish the image of this very helpful freelance website. So Be careful of this kind of bad people.