I'm trying to get all events by a certain page id, including the event picture. I've succeeded in this, but this method i'm using is very, very slow. I will try to explain the method as good as possible.
Step 1
$request = new FacebookRequest(
$session,
'GET',
'/{page-id}',
array(
'fields' => 'events'
)
);
I use this request to get all the events by the page id. This returns me an array with all the events. However, this array doesn't include the picture that belongs to each event. To get this fixed, I used a second loop to get the event picture by each unique event.
Note, before this loop I made sure that the array only exists of events that are yet to take place as well as a limit of loops (i.e. 5)
Step 2
$request = new FacebookRequest(
$session,
'GET',
'/$eventId', // this is the unique event id per event
array(
'fields' => 'cover'
)
);
This now gives me the cover of each unique event. It works, but it's sure not pretty. Also, it makes the page very, very slow as it has to loop though 6 requests before loading the page.
Is there anyone that can help me to figure out how to get all this information within one request? I am sure that there is someone willing to help.
Thanks in advance!