Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top