如何从 Facebook 页面获取所有事件

发布于 2024-10-22 05:27:31 字数 874 浏览 6 评论 0原文

StackOverflow 有大量关于从 Facebook 页面获取事件的答案。
它们都列出了 FQL 查询,我确信它们都工作得很好;但由于我是新手,所以我不知道这些查询是在什么上下文中执行的,以及如何进一步使用这些查询。

从 Facebook 页面获取所有事件应该非常简单。每种语言可能都应该有一个完整的复制+粘贴解决方案,但我还没有找到它。

理想情况下,我想要一个适用于 javascript 或 C# 的分步解决方案。

这几乎就是我想做的事情,我看不出为什么这不能在公共页面上工作(但事实并非如此):

<script>
    FB.init({
        appId: "196804317007661", // the appId for the website I registered with FB
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        xfbml: true  // parse XFBML
    });
    FB.api({
        method: "fql.query",
        query: "SELECT eid, name FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = PublicPageIdGoesHere)"
    },
    function (response) {
        console.log(response);
});

那么,有人知道一种即插即用的方式来让它工作吗?

There are tons of StackOverflow answers about getting events from a facebook Page.
They all list a FQL query and I'm sure they all work great; but since I'm new to this I have no clue as to what context these queries are executed and how to even get far enough to use these queries.

Getting all events from a facebook Page should be pretty trivial. There should probably be a complete copy+paste solution in every language but I haven't been able to find it.

Ideally, I would like a step-by-step solution that works in javascript or C#.

This is pretty much what I want to do and I see no reason why this shouldn't work on a public Page (but it doesn't):

<script>
    FB.init({
        appId: "196804317007661", // the appId for the website I registered with FB
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        xfbml: true  // parse XFBML
    });
    FB.api({
        method: "fql.query",
        query: "SELECT eid, name FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid = PublicPageIdGoesHere)"
    },
    function (response) {
        console.log(response);
});

So, anyone know of a plug-n-play way of getting this to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不即不离 2024-10-29 05:27:31

我知道该示例是用 VB 编写的,但我确信您可以将其移植到 C# 中,没有问题。以下是使用 Branches FB API 库的示例。

Dim FB As New SessionInfo("[access_token]")
Dim Req = New Functions.Requests(FB)
Dim EL = Req.GetEvents("[PageID]")
For Each E In EL
    Response.Write(E.id)
    Response.Write(E.name)
Next

这假设您已经拥有 FB 的 access_token。如果没有,您可以查看 api 上的身份验证示例。它是 .Net,因此您可以将其与 C# 一起使用。

I know the example is in VB but I'm sure you can port it to C# no problem. Here is an example using the Branches FB API library.

Dim FB As New SessionInfo("[access_token]")
Dim Req = New Functions.Requests(FB)
Dim EL = Req.GetEvents("[PageID]")
For Each E In EL
    Response.Write(E.id)
    Response.Write(E.name)
Next

This assumes that you already have an access_token from FB. If not you can check out the authentication example on the api. It's .Net so you can use it with C#.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文