Facebook Graph API过滤搜索结果

Med*_*ist 6 php types facebook filter facebook-graph-api

我正在使用PHP SDK来获取公共帖子中某个关键字的结果

$q = "something";
$results = $facebook->api('/search/','get',array('q'=>$q,'type'=>'post','limit'=>10));
Run Code Online (Sandbox Code Playgroud)

此查询返回与此类似的结果:

Array
(
    [id] => id
    [from] => Array
        (
            [name] => Some Random Name
            [id] => id
        )

    [message] => Hello hello hello. something
    [privacy] => Array
        (
            [value] => 
        )

    [type] => status
    [created_time] => 2013-10-31T10:20:58+0000
    [updated_time] => 2013-10-31T10:20:58+0000
)
Run Code Online (Sandbox Code Playgroud)

当你看到[type] => status部分时,这可以是状态,照片,链接等.我想只从包含搜索关键字的公共帖子中获取照片(换句话说,在包含$的公共帖子中搜索) q和filter/get/limit 10个结果只有[type] => photo value)

我怎样才能实现这一目标?我认为FQL对此没有帮助,因为我在公共帖子中搜索.

Abh*_*rty 5

不,这不可能,这可能在将来实现。

图api搜索需要API端点为

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

这里可能的对象类型是-发布,事件,用户,组等。

https://developers.facebook.com/docs/reference/api/search/

您所看到的返回值是字段,“类型”状态,照片,链接等是返回数据中的字段,但是您可以通过指定

&fields=id,name,picture,type 等等

您可以在以下网址的“可用搜索类型”中查看文档

https://developers.facebook.com/docs/graph-api/using-graph-api

您需要遍历结果并根据需要显示所需的结果。