Get event list based on location

做~自己de王妃 提交于 2019-12-09 05:00:42

问题


I've been digging around on the Facebook developer site to see if there is a way to get local event information for display on my own web app.

Ideally, I would pass up a location and Facebook would send down a list of local public events (with links to FB of course). But as yet I haven't found any documentation which says whether this is possible.

Does anyone know if this is possible?


回答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:


the quotes around the lat/longitude makes them a string. You'd be then comparing a float to a string



来源:https://stackoverflow.com/questions/9339936/get-event-list-based-on-location

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