【问题标题】:How to do a composite search in bing search API?如何在必应搜索 API 中进行复合搜索?
【发布时间】:2015-01-07 16:52:09
【问题描述】:

我正在尝试使用 php 在 bing 搜索 API 中进行复合搜索。从这个documentation 我得到了这个。

https://api.datamarket.azure.com/Data.ashx/Bing/Search/Composite?Sources=%27web%2bnews%27&Query=%27XBox%27&$top=1 This gives some result which i don't know to parse and show the result. I tried  `simplexml_load_file()` to parse but no use.

如果我提到像下面这样的 json 格式请求,我会收到一个错误的请求发送错误(未能打开流:HTTP 请求失败!HTTP/1.1 400 错误请求)和file_get_contents() 错误

https://api.datamarket.azure.com/Data.ashx/Bing/Search/Composite?Sources=%27web%2bnews%27&?$format=json&Query=%27XBox%27&$top=1

如何用json得到结果?

【问题讨论】:

    标签: php json azure


    【解决方案1】:

    您的正确查询是:(我在 $format=json 之前删除了“?”)

    https://api.datamarket.azure.com/Data.ashx/Bing/Search/Composite?Sources=%27web%2bnews%27&$format=json&Query=%27XBox%27&$top=1
    

    【讨论】:

      最近更新 更多