2011-10-06 60 views
0

有誰知道如何使用PHP和SOAP訪問Bing Translate服務(搜索api 2.0)?我一直在嘗試不同的方式,但沒有一個成功。這裏是我的代碼:使用PHP和SOAP訪問Bing翻譯服務

$soap=new SoapClient("http://api.search.live.net/search.wsdl");//"http://schemas.microsoft.com/LiveSearch/2008/03/Search" 
     $params["AppId"]=""; 
     $params["Query"]=$term; 
     $params["SourceLanguage"]=$lang_from; 
     $params["TargetLanguage"]=$lang_to; 
     $params["Sources"]="Translation"; 
     //$params["Translation"]=array(
      //"Translation"=>array(
      //"SourceLanguage"=>$lang_from, 
      //"TargetLanguage"=>$lang_to 
      //) 
     //); 
     //$params["Sources"]=$sources; 
     //$params["definitions"]=""; 
     //$res=$soap->Search(array("parameters"=>$params)); 
     die(print_r($soap->Search(array("parameters"=>$params)))); 

回答