gpt4 book ai didi

php - 使用 Facebook Graph Api 搜索帖子

转载 作者:可可西里 更新时间:2023-11-01 00:11:15 24 4
gpt4 key购买 nike

我想使用图形 API 搜索过去 30 天数据的帖子(新闻提要)?这样做的最佳做法是什么? Facebook Graph API 是否有 API 限制来限制 HTTP 请求的请求?

最佳答案

注意:以下均不再有效。从 Facebook Graph API 2.3 版开始,搜索端点已被弃用。

正在复制 from here under "Searching" :

Searching

You can search over all public objects in the social graph with https://graph.facebook.com/search. The format is:

https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE

We support search for the following types of objects:

* All public posts: https://graph.facebook.com/search?q=watermelon&type=post
* People: https://graph.facebook.com/search?q=mark&type=user
* Pages: https://graph.facebook.com/search?q=platform&type=page
* Events: https://graph.facebook.com/search?q=conference&type=event
* Groups: https://graph.facebook.com/search?q=programming&type=group
* Places: https://graph.facebook.com/search?q=coffee&type=place&center=37.76,122.427&distance=1000
* Checkins: https://graph.facebook.com/search?type=checkin

You can also search an individual user's News Feed, restricted to that user's friends, by adding a q argument to the home connection URL:

* News Feed: https://graph.facebook.com/me/home?q=facebook

这是实现此目的的一种方式。但你最好的选择是使用 FQL ,由 JavaScript SDK 使用, 与 fb.dataquery method .你想要做的是使用 stream table获取用户的状态帖子。

现在,根据您的问题,我了解到您更愿意使用 PHP 版本而不是 Javascript 版本。按照那个,你需要做的是解码(使用 json_decode)这个 url 接收到的 json 对象:

https://graph.facebook.com/[USERNAME/USERID]?fields=posts&access_token=[A VALID ACCESS TOKEN]

据我所知,这个灵魂是没有极限的。然而,看看 docs here .

关于php - 使用 Facebook Graph Api 搜索帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4880591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com