Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $isFan = false;
- $graphArguments = array(
- 'access_token' => USER's ACCESS TOKEN,
- );
- // get likes from user
- $graphUrl = 'https://graph.facebook.com/me/likes?';
- $graphUrl .= http_build_query($graphArguments);
- $likes = file_get_contents($graphUrl);
- $likes = json_decode($likes);
- if($likes && $likes->data) {
- foreach($likes->data as $like) {
- // if user liked our page
- if($like->id == Yii::app()->params['facebookPage']['id']) {
- $isFan = true;
- break;
- }
- }
- }
- if($isFan) {
- echo 'User is fan!';
- } else {
- echo 'User is not a fan!';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement