How to check if a user is a fan of your page

The like box

The Like box, makes your site visitors fans of your company's Facebook page. From that moment on, they will see every announcement that you post on your Facebook Page in their Most Recent News feed.

Like Boxes are most often used on the homepage and in repeating sections of your website like side-bars and columns.

How to check if a user is a fan of your facebook page

Or, how to check if a user clicked the like box of your fan page!

Do you catch the similarity? It's the same thing!

Here's the code:

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

        if (empty($data["page"]["liked"])) {
            echo "You are not a fan!";
        } else {
            echo "Welcome back fan!";
        }
?>

 

Post A Comment

Anti-Spam Quiz: