如何创建页面所有事件?
我尝试了以下内容:
https://graph.facebook.com/PAGEID/events
但我没有得到任何数据。
有人可以帮助我吗?
答案 0 :(得分:1)
我遇到了同样的问题,并且还更新了ivan.abragimovich提到的错误。
我并不为此感到自豪,但这是我作为一个解决方案所做的。
$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);
}
}
}
}
答案 1 :(得分:0)
您确定有与该页面相关的事件吗?您可能想检查是否可以检索Feed。只需在网址中将“活动”与“Feed”交换即可。