What I want to do is check user go in my app before must like my fan page, I had a problem some user are successfully, but some user are not successfully
if this user without find friends, it's not working with my code
if this user with find friends, it's successfully working
Isn't this is facebook bug or my code problem or because of new user and old user?
here is my code to detect user already like my fan page
$user = $facebook->getUser();
if ($user) {
try {
$likes = $facebook->api("/me/likes/mypageid");
//var_dump($likes);
//exit;
if( empty($likes['data']) ){
?>
<script type='text/javascript'>top.location.href = 'https://www.facebook.com/testing';</script>
<?php
exit;
}
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
Thanks