如何在bing搜索API中进行复合搜索?

时间:2014-02-22 11:23:00

标签: php json azure

我正在尝试使用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获得结果?

1 个答案:

答案 0 :(得分:0)

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

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