Facebook graph api - search event

When searching by request, the query searches only by the name of the event: sample http://graph.facebook.com/search?q=party&type=event

  • Is there any way to request a description of the event? Or other fields?

I tried to use before or after, but I get the same results https://graph.facebook.com/search?q=party&type=event&until=today https://graph.facebook.com/search?q=party&type=event&until=yesterday

  • FQL accepts only search by event id
+6
source share
2 answers

The search returns an identifier for all events returned in the search. Using https://graph.facebook.com/search?q=party&type=event&until=today&fields=id , you can loop the results of the identifier to https://graph.facebook.com/eventid?access_token=yourapptoken to get an array of the event that will be include description, name, image, etc .;

A live example for searching pages and events is here: http://shawnsspace.com/plugins/plugins.searcher.php

Refer to: http://developers.facebook.com/docs/reference/api/event/

Code example:. It is assumed that the page has installed PHP-SDK 3.1.1.

Events 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> 

+5
source

The search in the Graph API for events is currently limited only to the name of the event; I do not believe that there are plans to change this in the short term, unfortunately

+1
source

Source: https://habr.com/ru/post/895934/


All Articles