I was making a facebook application in which i have to show news feeds of the user who is using it. I am using graph API to do this. The problem is that its not getting me feeds. I used it to show friends like this:
$friends = $facebook->api( /me/friends );
并且正在罚款。
供新闻参考的是:
$feeds = $facebook->api( /me/home );
这表明我有了一个错误:
Fatal error: Uncaught IDInvalidException: Invalid id: 0 thrown in
/home/content/58/6774358/html/test/src/facebook.php on line 560
当我试图通过下列方式获取简介资料时:
$feeds = $facebook->api( /me/feed );
it shows me an empty array.
These API calls are showing me results in the graph API page but don t know why not working in my application.Can any one help me please.. My full code is as follows
require_once src/facebook.php ;
// Create our Application instance. $facebook = new Facebook(array( appId => xxxxx , secret => xxxxx , cookie => true, ));
$session = $facebook->getSession();
$fbme = null;
// Session based graph API call.
if (!empty($session)){
$fbme = $facebook->api( /me );
}
if ($fbme) {
$logoutUrl = $facebook->getLogoutUrl();
echo <a href=" .$logoutUrl. ">Logout</a> ;
}else{
$loginUrl = $facebook->getLoginUrl();
echo <a href=" .$loginUrl. ">Logout</a> ;
}
$friends = $facebook->api( /me/friends?access_token= .$session["access_token"]);
$feeds = $facebook->api( /me/feed?access_token= .$session["access_token"]);
print( <pre>Herere: );print_r($feeds);die;