Facebook Graph显示活动参加者 [英] Facebook Graph to show Event Attendees

查看:75
本文介绍了Facebook Graph显示活动参加者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在PHP页面上显示给定Facebook事件的参与者.理想的情况是图形显示和人们的图片显示.

I am looking to display the attendees for a given facebook event on a PHP page. Ideally it would be that graphical display with people's pictures displaying.

我相信可以使用facebook graph API来完成此操作,但是以下内容给我一个需要签名的错误:

I believe this could be done using the facebook graph API, but the following is giving me an error requiring signature:

https://api.facebook.com/method/fql.query?query=SELECT uid FROM event_member WHERE eid =  ... AND rsvp_status = 'attending'

此外,我什至会得到开斋节吗?可以简单地从事件页面链接的末尾解析它吗? www.facebook.com/events/... eid#...

Also, how would I even get the eid? Can it simply be parsed off the end of an event page link? www.facebook.com/events/...eid#...

谢谢大家!

推荐答案

要吸引活动参加者,您可以按照

To get event attendees you can run following FQL query:

SELECT uid FROM event_member WHERE eid = "EXISTING_EVENT_ID"

如果您是通过图形API 您将获得事件ID作为响应.或者,您可以获取当前/特定用户参加的事件的ID.或您已经在活动页面的网址中指出的那样.

Event id is something you can get from many sources, if you create event via Graph API you'll get event id as response. Or you can get ids of events current/specific user attending. Or as you already noted from URL of event page.

下一个FQL查询将返回当前用户正在参加的所有事件:

Next FQL query will return all events current user is attending:

SELECT eid FROM event_member WHERE uid = me() AND rsvp_status = "attending"

查询可以嵌套,因此您可以执行诸如获取当前用户曾经参加过的所有活动的所有与会者的列表之类的事情:

Queries can be nested so you can do stuff like get list of all attendees of all events current user ever attended:

SELECT eid, uid FROM event_member WHERE eid IN (
  SELECT eid FROM event_member WHERE uid = me() AND rsvp_status = "attending"
)

要获取特定事件的与会者详细信息,可以执行以下操作:

To get details of attendees for specific event something like this may do the work:

SELECT uid, name, pic_square FROM user WHERE uid IN (
  SELECT uid FROM event_member WHERE eid = "EXISTING_EVENT_ID"
)

注释:

  • 您需要任何有效的access_token来获取公共事件的详细信息.
  • 要检索当前用户的事件,您需要获得该用户向您的应用授予的user_events权限.
  • 您可以仅通过http://graph.facebook.com/{USER_ID}/picture
  • 格式显示带有URL的ID的用户图像.
  • 您可以通过向https://graph.facebook.com/fql?q={QUERY_HERE}发出GET请求来使用Graph API运行FQL查询.
  • You'll need any valid access_token to get public events details.
  • To retrieve events of current user you'll need user_events permission to be granted to your application by this user.
  • You can display user image with only knowing his id with URL in format of http://graph.facebook.com/{USER_ID}/picture
  • You can run FQL queries with Graph API by issuing GET request to https://graph.facebook.com/fql?q={QUERY_HERE}

有关 FQL user

For more details on FQL and Graph API read documentation, especially on tables event_member and user

这篇关于Facebook Graph显示活动参加者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆