0

我正在开发一个带有PHP Facebook SDK. 我通过图表获取一个地方的所有事件,并通过代码在网站上显示它们:

$evt=$facebook->api('/search?fields=name,description,location,start_time,end_time&q='.urlencode($var[0]).'+'.$_GET['tipo'].'&type=event&limit=500&since=today&until='.$dq);

这可行,但我有这个问题:在网站上,我还通过 Facebook 登录获得了网络用户的 Facebook ID,并将其 id 存储到我的MySQLDatabase table 中pnota_USERS

要获取存储在我的数据库中的 Facebook ID 的所有事件,我使用以下代码:

$db_host=modGoogleResHelper::db_host($params);
$db_pass=modGoogleResHelper::db_pass($params);
$db_user=modGoogleResHelper::db_user($params);
$db_name=modGoogleResHelper::db_name($params);


$db=mysql_connect($db_host,$db_user,$db_pass) or die("errore nella connessione al database");

mysql_select_db(db_name);
$query="select * from pnota_users where facebook_id<>'' or facebook_id<>null";
$riga="";
$ret=mysql_query($query,$db);
if(mysql_affected_rows()>0){
while($row=mysql_fetch_array($ret))
{
$riga.=$row['facebook_id'].";";
}
mysql_free_result($ret);
}
$query="";
$rrx=explode(";",$riga);

foreach($rrx as $kkx)
{
if($kkx!="")
{
$zzz= $facebook->api('/'.$kkx.'/events', 'get', array("fields"=>"id, owner, name,location"));
print_r($zzz);
$fql = "SELECT name, location, start_time,end_time,eid FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid =".$kkx.") and start_time >='".$today."' and start_time<='".$tomorrow."' order by start_time desc" ;
$ret_objxx = $facebook->api(array(
'method'    =>'fql.query',
'req_perms' => 'friends_events,publish_stream,read_friendlists,email,user_events,manage_friendlists,rsvp_event,manage_notifications,user_online_presence',
'query'     => $fql) );

foreach($ret_objxx as $keyxx)
    {
$item=array("eid" => keyxx[eid],"name"=>'.',"start_time"=>$keyxx[start_time],"end_time"=>$keyxx[end_time],"timezone"=>'-',"location"=>$keyxx[location]);
array_push($events,$item);
    }
    }
    } 

此 FQL 没有显示结果。我尝试将查询 FQL 直接放到 Graph API Explorer 中:在 Graph API Explorer 中,如果我在右上角选择,应用程序 Graph API Explorer 会显示结果。如果我在右上角的 Graph API Explorer 中选择,iprimanota作为我的应用程序名称的应用程序 Graph API Explorer 不会向我显示结果。

我的问题是这样的:

我使用了错误的许可

4

0 回答 0