Facebook API - How to check in application for fans?
I try to create an facebook application. I created a new applicati开发者_如何学JAVAon and downloaded the framework. In my index.php i do the following:
<?php
require_once 'facebook.php';
$appapikey = '123456...xyz';
$appsecret = '123456...xyz';
$facebook = new Facebook($appapikey, $appsecret);
$user_id = $facebook->require_login();
$pageid = "123456...xyz";
$isfan = $facebook->api_client->pages_isFan($pageid);
if($isfan)
echo '<iframe src="http://www.google.com/" width="720" height="1250" frameborder="0"></iframe>';
else
echo 'you have to become a fan!';
Without $isfan, it shows me the correct output. But with this question, I always see the else statement (also when I am a fan).
Any ideas?
Maybe my $pageid is not correct. I showed on my page (e.g. http://www.facebook.com/pages/Microsoft/107785359249238?ref=ts ) and used 107785359249238 as pageid. Is that right?
Try to pass user_id as a second parameter.
精彩评论