2014-02-22 80 views
0

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

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获得结果?

回答

0

你正确的查询:( “?” 我$格式之前删除= JSON)

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