I am trying to get a list of all the names & id of people actually going to an event I create. Getting the list using the php graph api for facebook was the easy part and seems to work.
Code (php) the get the data:
//GET ATTENDING
$getattending = "/" . $event_id . "/attending?fields=name,id"; $req_events = new FacebookRequest($session, 'GET', $getattending); $req_response = $req_events->execute(); $data_array = $req_response->getGraphObject()->asArray(); $counter = array_map("count", $data_array); $count = $counter['data']; echo "Attending: $count<BR>"; echo "<PRE>"; print_r($data_array); echo "</PRE>";
The result:
Array (
[data] => Array ( [0] => stdClass Object ( [name] => Thierry Martens [id] => 788923242 ) [1] => stdClass Object ( [name] => Lisa Mario Laurier [id] => 708876902536391 ) [2] => stdClass Object ( [name] => Ramy Mahfoudhi [id] => 735036479911364 ) [3] => stdClass Object ( [name] => Jeremy Verriest Duroisin [id] => 783108468420824 ) [4] => stdClass Object ( [name] => Jonas En Svetlana Laurier [id] => 773139856081632 ) [5] => stdClass Object ( [name] => Maxime Demerliere [id] => 849400761761008 ) [6] => stdClass Object ( [name] => Jeremy Beauchamp [id] => 10204174155667109 ) [7] => stdClass Object ( [name] => Sari Jens Delcourte Delusinne [id] => 10204086515874904 ) [8] => stdClass Object ( [name] => Pieter Marysse [id] => 10204911283045115 ) [9] => stdClass Object ( [name] => Patrick Vanden Bosschelle [id] => 10202907209181148 ) )
BUT i am having problems to actually gather the data itsels; i simply need the name and the id in simple array or list so i can use it in the rest of the script. Any ideas Anyone?
My second question is the php graph api seems to have a "/eventnr/attending" thing for graph 2.1; showing nr attendants to your event in question; but when i actually call it i get an error stating i need to use graph 2.1 while i uploaded the latest php sdk and can't seem to find a way to change that version. This question is not as important as the one above; but if it works i would need less code :)
Hope you guys can help me :)