I am using the following code (found on SO) to post Events on behalf of my Facebook page.
require_once 'fb-sdk/facebook.php';
$facebook = new Facebook(array(
'appId' => 'APPID',
'secret' => 'SECRET'
));
$facebook->setAccessToken('TOKEN');
try {
$retObj = $facebook->api('/PAGE_ID/events/create', 'POST', array(
"name" => 'Test Event 1234',
"description" => 'This is a test!!',
"start_time" => '2013-03-19'
));
} catch(FacebookApiException $e) {
echo $e->getMessage();
}
This works fine and dandy to create the event, but then afterwards I want to come back and add a Cover Photo to the event using the following code (again, found on SO):
$cover['cover_url'] = 'MYIMAGE.jpg';
$eventUpdate = $facebook->api( "/" . $fbEvent['id'], 'post', $cover );
This code requires an event ID that is generated when the event is posted.. so my question is:
how do I return the Event ID after posting an event, so it can be used to update my Event Cover Photo?
Or better yet, is there a streamlined way of creating the event, and adding the Cover Photo all in one go?