根据位置获取事件列表 [英] Get event list based on location

查看:18
本文介绍了根据位置获取事件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 Facebook 开发者网站上搜索,看看是否有办法获取本地事件信息以显示在我自己的网络应用程序上.

理想情况下,我会传递一个位置,Facebook 会发送一份当地公共活动列表(当然还有 FB 的链接).但到目前为止,我还没有找到任何说明这是否可行的文档.

有人知道这是否可能吗?

解决方案

确实可以使用基于位置的搜索"来接收事件为此,您需要要搜索的位置的经度和纬度坐标以及具有 user_events 权限的 access_token(我认为您也可以使用公共搜索)

这里有一个 FQL 示例,说明如何获取某个位置附近的所有事件.(这是从您和您朋友的活动中搜索的):

$lat = "40";$long = "30";//使用偏移量在地图上给我们一个正方形",从哪里搜索事件$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 FROMfriend WHERE uid1 = me()) AND start_time > '. $created_time .' OR uid = me()) AND start_time >'.$created_time .'AND 场地.经度<\''.($long+$offset) .'\' ANDvenue.latitude <\''.($lat+$offset) .'\' ANDvenue.longitude >\''.($long-$offset) .'\' ANDvenue.latitude >\''.($lat-$offset) .'\' ORDER BY start_time ASC '.$限制;

技巧本身在于场地.经度和场地.纬度的使用.要从城市获取事件,只需获取城市坐标并根据需要调整偏移量.如果您不知道如何使用 FQL,请查看 Facebook PHP SDK>

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?

解决方案

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

这篇关于根据位置获取事件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆