1

我是大学最后一年的计算机专业学生,几乎没有编程经验。如果有人可以帮助我,我将非常感激。我正在尝试列出单个 Facebook 用户登录时的所有 Facebook 事件,但下面的数组返回为空且没有错误。

<h1>events</h1>

<?php

$me='MY-FACEBOOK-ID';

$accesstoken='MY-ACCESS-TOKEN';

//include the Facebook PHP SDK
include_once 'facebook-php-sdk-master/src/facebook.php';

//instantiate the Facebook library with the APP ID and APP SECRET
$facebook = new Facebook(array(   
'appId' => 'MY-APP-ID',   
'secret' => 'MY-FACEBOOK-SECRET',  
'cookie' => true));


$user= $facebook->getUser();
$user_profile=$facebook->api('/me');;
print$user;

$multiQuery = '{
         "attending":"SELECT name, start_time, end_time, location, description FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = '.$user.' AND rsvp_status=\'attending\')",
         "maybe":"SELECT name, start_time, end_time, location, description FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = '.$user.' AND rsvp_status=\'unsure\')",
         "declined":"SELECT name, start_time, end_time, location, description FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = '.$user.' AND rsvp_status=\'declined\')",
         "not_replied":"SELECT name, start_time, end_time, location, description FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = '.$user.' AND rsvp_status=\'not_replied\')",
         }';

$param = array(      
     'method' => 'fql.multiquery',      
     'queries' => $multiQuery,      
     'callback' => '');

try{      
    $events = $facebook->api($param);
    var_dump($events);
    $event2=$facebook->api("/$user/events?limit=1000");
    var_dump($event2);
}catch(Exception $e){echo $e->getMessage();}


?>
4

0 回答 0