Yan
Yan

Reputation: 1444

get my facebook friends attending to events

i want to get from facebook the events that my friends are going to them. for example

  1. eventId1 (friend1,friend2,friend3)
  2. eventId2 (friend10,friend55);

and so on...

how can i accomplish it ?

thank for replays.

Upvotes: 1

Views: 2083

Answers (3)

jlb
jlb

Reputation: 19990

expanding on sarfaz's answer:

use the following query for each of your friends:

SELECT name FROM event WHERE eid IN (SELECT eid from event_member WHERE uid = $friend_uid )

that will return the exact list of events that friend is attending. then, parse that list of friends and gather the events they are attending in order to create a reversed map of the data.

from my experience this FQL query takes a long time to execute, especially if you are going to be running it multiple times for each of your friends. be weary of facebook timeouts if you are using an FBML app -- otherwise you might want to batch this call.

Upvotes: 1

DanDan
DanDan

Reputation: 10562

The api says events.get should help you. Pass in the uid of each of your friends and consolidate the event ids that come back.

edit: sarfraz may have the better answer here, one call to FQL is going to be more efficent.

Upvotes: 0

Sarfraz
Sarfraz

Reputation: 382706

One way do get events is using the FQL. Here is how you can get all the events your friends are going to attend:

SELECT name FROM event WHERE eid IN (SELECT eid from event_member WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=''$user_id'') )

More here:

More here

Upvotes: 2

Related Questions