views:

186

answers:

3

How can i get all the Events a Page have created?

I've tried the following:

https://graph.facebook.com/PAGEID/events

But i don't get any data back.

Can someone help me?

Thanks in advance

A: 

Are you sure there are events that are associated with the Page? You might want to check if you can retrieve the feed. Just swap "events" with "feed" in the URL.

Brent Baisley
I created an event from the Page, so i guess it would be associated?When i change it to "feed" i get some data
Mikkel
Did you check that the event is associated with the page and not your account? Change the ID to your ID and see if it's there.
Brent Baisley
It should be associated with the page, mainly because when i go to the "Events" page on the Page it shows the event. I tried to use my ID, the result was the same: nothing
Mikkel
A: 

This is a bug which is described here http://bugs.developers.facebook.com/show_bug.cgi?id=10399

ivan.abragimovich
A: 

I've run in to the same issue and also updated the bug mentioned by ivan.abragimovich.

I'm not proud of it, but here is what I did as a work around.

$accessToken = "..."; // your OAuth token
$uid = "..."; // the id of the page you are using
$feed = $this->facebook->api("/$uid/feed", "GET", array('access_token' => $accessToken,
'limit' => 20));

// temp method of retrieving events until the page events bug is fixed.
// @see http://bugs.developers.facebook.com/show_bug.cgi?id=10399
if (array_key_exists('data', $feed) && is_array($feed['data']))
{
    foreach($feed['data'] as $item)
    {
        if ($item['type'] == "link" && strpos($item['link'], "eid=") !== false)
        {
            preg_match('/eid=(\d+)/', $item['link'], $urlMatches);
            if (count($urlMatches) == 2)
            {
                $eventId = $urlMatches[1];
                $event = $this->facebook->api("/$eventId", 'GET', array('access_token' => $accessToken));
                print_r($event);
            }
        }
     }
}
Chris Gutierrez