2010-11-13 40 views
1

使用FQL我想提出一個FB應用程序,這是我需要做的:需要用戶會話的錯誤而在Facebook的

我拿到營業頁的頁ID,我需要獲得頁面的admin_id 。我正在使用下面的代碼,並收到我在最後複製的錯誤消息。

任何人都可以幫助我嗎?謝謝。

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 

回答

1

Problem while executing Facebook query

答案就在這裏提供,

我們需要編寫以下行...

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

謝謝:)

+4

請注意,如果您使用的Facebook PHP SDK大於3.0,則這些方法不再存在,因此也不是修正。 – 2011-09-06 14:23:11