Skip to content

Instantly share code, notes, and snippets.

@pietromalerba
Forked from niraj-shah/like_fb4.0.x.php
Last active August 29, 2015 14:12
Show Gist options
  • Save pietromalerba/205433f1f15aac130f1d to your computer and use it in GitHub Desktop.
Save pietromalerba/205433f1f15aac130f1d to your computer and use it in GitHub Desktop.
<?php
// get like status
$liked = (new FacebookRequest( $session, 'GET', '/me/likes/' . $page_id ))->execute()->getGraphObject()->asArray();
// if $liked return array with at least one result, user has liked the page
if ( isset( $liked ) && count( $liked ) > 0 ) {
echo '<h2>Liked</h2>';
} else {
echo '<h2>Not Liked</h2>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment