Does anyone know how to access Bing Translate service (search api 2.0) with PHP and SOAP? I've been trying different ways but no开发者_如何学Cne was yet successful. Here's my code:
$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))));
why don't you try this simple method?
http://www.som3on3.com/programming/php/php-bing-translate-api/
精彩评论