在事件搜索中,查询仅按事件名称搜索: 示例http://graph.facebook.com/search?q=party&type=event
我尝试使用直到或之后,但我得到相同的结果 https://graph.facebook.com/search?q=party&type=event&until=today https://graph.facebook.com/search?q=party&type=event&until=yesterday
答案 0 :(得分:5)
搜索返回搜索中返回的所有事件的ID。使用https://graph.facebook.com/search?q=party&type=event&until=today&fields=id,您可以将id结果循环到https://graph.facebook.com/eventid?access_token=yourapptoken,以获取包含描述,名称,图像等事件的数组;
Page&的实时示例事件搜索: http://shawnsspace.com/plugins/plugins.searcher.php
请参阅: http://developers.facebook.com/docs/reference/api/event/
示例代码:假设在页面上安装了PHP-SDK 3.1.1。
活动 https://graph.facebook.com/search?q=conference&type=event
<?php
$qi = urlencode($_GET['qs']);
if(!$_GET['qs']){
$qi = urlencode($_POST['qs']);
if(!$_POST['qs']){
$qi = "party";
}
}
$search = $facebook->api('/search?q='.$qi.'&type=event&limit=10');
foreach ($search as $key=>$value) {
$i=1;
foreach ($value as $fkey=>$fvalue) {
$i++;
if($fvalue[id]=="h"){
}else{
$id = $fvalue[id];
$searchResp = $facebook->api('/'.$id.'');
$name = $searchResp[name];
$location = $searchResp[location];
$desc = $searchResp[description];
$sTime = $searchResp[start_time];
$eTime = $searchResp[end_time];
echo $name. '<br />';
echo $location. '<br />';
echo $sTime. '<br />';
echo $eTime. '<br /><hr />';
}
};
};
?>
<form id="getsearch" method="post" action="yourpage.php">
<input type="text" value="" name="qs" id="searchbox" onclick="this.value='';" style="padding: 2px;" size="48">
<input type="submit" value="Search" style="padding: 3px;">
</form>
答案 1 :(得分:1)
在Graph API中搜索事件目前仅限于事件名称;我不相信有可能在短期内改变这种情况,不幸的是