我已经搜索了一段时间的谷歌,找到一种方法来获得一个随机的Facebook活动页面的ID到一个网站上。到目前为止,我一直在获取所有事件的信息,如标题描述中的成功,但我有一个问题,获得rsvp状态。我尝试了几件事情,但没有成功,现在我写的脚本在昨天工作的时候不会工作。Facebook事件API
这里是我的代码:
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);
//此代码工作得很好,但现在它doesen't了,因为我不能为用户
另一件事我想TOT做登录从事件中获得参加按钮是否有人有任何想法?
谢谢现在我得到主治按钮的部分。我真的不想获得用户的rsvp_status,我想要获取实际事件的rsvp_status,看看谁正在参加我可以使用的内容?有没有办法从我的脚本中注销自己? – 2012-08-12 16:28:18
是的,你可以注销你的脚本,但是如果你还没有对它进行编码,注销FB也会将你从脚本中注销。您可以通过从上面的#attending_event查询中删除'uid = me()'来查看参加该活动的所有id的列表。你可以通过在你的'#event_info'查询中加入'attending_count'等字段来计数。 – cpilko 2012-08-12 16:34:26
谢谢你很多我目前正在努力实现这一点,我会尽快回复:D。 – 2012-08-12 16:38:32