FQL query for finding public event

柔情痞子 提交于 2019-12-08 00:47:50

问题


I would like to execute an FQL query for retrieving all the public events in a specific area (using longitude,latitude and maximum distance or simply location name). Do you know if it's possible?

Apparently, somebody is able to do it, somehow: http://elmcity.info/fb_events?location=tokyo


回答1:


It is possible indeed to receive events using location based "search" To do so you'll need the longitude and latitude coordinates of the location you want to search and a access_token with user_events permission (i think you could also use the public search)

Here's an FQL example how can you get all the events nearby of a location. (this searches from your and your friends events):

$lat = "40";
$long = "30";

// using offset gives us a "square" on the map from where to search the events
$offset = 0.4;

$events = 'SELECT pic_big, name, venue, location, start_time, eid FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND start_time > '. $created_time .' OR uid = me()) AND start_time > '. $created_time .' AND venue.longitude < \''. ($long+$offset) .'\' AND venue.latitude < \''. ($lat+$offset) .'\' AND venue.longitude > \''. ($long-$offset) .'\' AND venue.latitude > \''. ($lat-$offset) .'\' ORDER BY start_time ASC '. $limit;

The trick itself lies in the venue.longitude and venue.latitude useage. To get events from a city, just get the city coordinates and adjust the offset to your needs. If you don't know how to use FQL please look into Facebook PHP SDK




回答2:


I'm wrestling with this same problem right now. It does not look possible. There are several problems I see:

  • the location fields are not searchable in the page or place tables,
  • the way event locations are populated is inconsistent: See this page's events for an example. (I personally populated most of these. These are FB changes, not user error.),
  • FQL does not have an AS statement to query based on the result of a calculation, and
  • Facebook limits the amount of items returned by a query to some fairly low value.

What the referenced site seems to do is query event.description for the presence of the input string. Query "IKEA", and you'll get lots of results. Definitely not a geo search. (BTW, the site's source code is on GitHub).

Edit:

Okay, I was wrong. Facebook does expose a search method, but only in the Graph API. Using the batch request functionality, you could execute a series of requests that:

  • Find all place entries within a distance (in meters) of a known lat/long. The graph api accepts q=* for the search string to return all places.
  • Query event to find all events at the places returned above.

I'm going to play with this. I'll update this post again as I flesh out this code better.




回答3:


try this code worked for me returns all details of the upcoming public event which contains a specific key word that can be your location

SELECT eid,name,description,venue,creator,location,ticket_uri,start_time, eid,host,not_replied_count,pic_square,pic_big,unsure_count,attending_count,declined_count,all_members_count FROM event WHERE start_time > now() AND CONTAINS("your location name") AND privacy='open'



回答4:


I believe that in http://elmcity.info/fb_events?location=tokyo they are not really searching for events in Tokyo, they simply executing a query like this

https://graph.facebook.com/search?type=event&q=tokyo

(access token is needed, see https://developers.facebook.com/tools/explorer?method=GET&path=search%3Ftype%3Devent%26q%3Dhaifa)

Note that this url also works http://elmcity.info/fb_events?location=sport

I'm also looking for a way to retrieve public events using fql and so far I didn't find any.



来源:https://stackoverflow.com/questions/10881388/fql-query-for-finding-public-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!