开发者

Access Bing translate service with PHP and SOAP

开发者 https://www.devze.com 2023-04-11 09:26 出处:网络
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:

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消