views:

470

answers:

3

hey

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.

+1  A: 

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

Sarfraz
heyyes its good i am getting list of all my friends events.but i want to know for each event which of my friends are going to it.
Yan
please go to the link i posted in my answer. there are more details about it.
Sarfraz
i saw the link, its not helping me much. i cant get from there the names of my friends to this event. as my example said, ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; event 1 (michkl,jeny,fabric); event 2 (lisa,leonard,jermey) event 3 (antony,papa) – Yan 0 secs ago
Yan
A: 

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.

DanDan
A: 

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.

Janek