我已经在谷歌上搜索了一段时间,以找到一种通过 id 将随机 facebook 事件页面获取到网站上的方法。到目前为止,我已成功获取所有事件的信息,如标题描述中的图片,但我在获取 rsvp 状态时遇到问题。我尝试了几件事,但没有成功,现在我写的脚本在昨天运行良好的情况下甚至无法运行。
这是我的代码:
require_once("facebook-platform/src/facebook.php");
$config = array();
$config['appId'] = 'aaaaaaa';
$config['secret'] = 'bbbbbbbbbb';
$config['fileUpload'] = false; // optional
$facebook = new Facebook($config);
// See if there is a user from a cookie
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
$user = null;
}
}
var_dump($user);// to check the returned user account which is int(0) and yesterday it
//worked fine giving me all the details
//now this is the code for getting the event
$fql='{
"event_info": "SELECT name,description, pic_small,pic_big, eid,venue,location FROM event WHERE eid =266159320165868",
"event_venue":"SELECT name, username, page_id,location FROM page WHERE name IN (SELECT venue.id FROM #event_info)"
}';
$setup = array(
'method' => 'fql.multiquery',
'queries' => $fql,
'callback' => ''
);
$result = $facebook->api($setup);
//这段代码运行良好,但现在不再运行了,因为我无法以用户身份登录
我想做的另一件事是从活动中获取参加按钮有人有什么想法吗?