本文介绍了在Facebook中使用FQL时需要用户会话错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个fb应用程序,这是我需要做的:

I am making a fb app and this is what I need to do:

我获得了业务页面的页面ID,并且需要获得页面的admin_id.我正在使用以下代码,并且收到错误消息,该消息已在结尾处复制.

I get the page id of a business page and I need to get the admin_id of the page. I am using the following code and I get the error message which I have copied at the end.

有人可以帮助我吗?谢谢.

Can anyone kindly help me ? Thanks.

include_once 'facebook.php';

$facebook = new Facebook($api_key, $secret);

//$page_ids == page_id of a business/fan page

$query="SELECT uid from page_admin where page_id =".$page_ids.";";

$admins =$facebook->api_client->fql_query($query);

foreach ($admins as $jerry) {
  echo $jerry['uid']."<br>";
}

错误消息:

Fatal error: Uncaught exception 'FacebookRestClientException' with message 'Requires user session' in /var/www/seanpeace/data/www/racersnation.com/facebookTest/facebookapi_php5_restlib.php:3112 Stack trace: #0 /var/www/seanpeace/data/www/racersnation.com/facebookTest/facebookapi_php5_restlib.php(1025): FacebookRestClient->call_method('facebook.fql.qu...', Array) #1 /var/www/seanpeace/data/www/racersnation.com/facebookTest/profile.php(64): FacebookRestClient->fql_query('SELECT uid from...') #2 {main} thrown in /var/www/seanpeace/data/www/racersnation.com/facebookTest/facebookapi_php5_restlib.php on line 3112

推荐答案

执行Facebook查询时出现问题

答案在这里

我们需要写以下几行...

we need to write the following lines...

$ facebook =新的Facebook($ api_key,$ secret);$ facebook = $ facebook-> require_login();$ facebook = $ facebook-> require_frame();

$facebook = new Facebook($api_key, $secret);$facebook = $facebook->require_login();$facebook = $facebook->require_frame();

谢谢:)

这篇关于在Facebook中使用FQL时需要用户会话错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 15:57