2014-02-22 70 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