2011-04-26 142 views
1

我應該使用什麼參數才能從僅有網站的搜索結果中使用bing 2.0 API說abcd.com?我正嘗試以JSON格式獲取結果。任何人都可以幫忙嗎?必應自定義搜索引擎

回答

0

不知道怎麼API作品,但在查詢參數放在「網站:abcd.com臘肉」的JSON格式,其中臘肉是原始查詢。

我使用的XML格式,所以如果我派一個請求:

http://api.search.live.net/xml.aspx?Appid=________&query=site%3Aabcd.com+bacon&sources=web&web.count=5&web.offset=0 
2

新代碼羣衆

  $query = array 
     (
      'AppId' => <API_KEY>, 
      'sources' => 'Web', 
      'query' => 'site:www.tipografix.ro '.$keywords, 
      'Version' => '2.0', 
      'Options' => 'EnableHighlighting', 
      'Web.Count' => $per_page, 
      'Web.Offset' => $page_num, 
      'Web.Options' => 'DisableHostCollapsing DisableQueryAlterations' 
     ); 

     $request = 'http://api.bing.net/json.aspx?'.http_build_query($query); 

     $response = file_get_contents($request); 
     $jsonobj = json_decode($response);