如何获取页面创建的所有事件?
我尝试了以下方法:
https://graph.facebook.com/PAGEID/events
但我没有得到任何数据。
有人能帮我吗?
如何获取页面创建的所有事件?
我尝试了以下方法:
https://graph.facebook.com/PAGEID/events
但我没有得到任何数据。
有人能帮我吗?
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);
}
}
}
}
您确定有与主页相关联的事件吗?您可能想检查是否可以检索提要。只需在 URL 中将“事件”与“提要”交换即可。