62,046
社区成员
发帖
与我相关
我的任务
分享
public class Bing
{
public static string GetGoogtextStr(string textstr)
{
if (textstr == null || textstr == "")
{
return "";
}
else
{
WebClient web = new WebClient();
WebHeaderCollection headers = new WebHeaderCollection();
headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded; charset=utf-8";
web.Headers = headers;
string text = textstr;
string uri = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate?oncomplete=mycallback&appId=A4D660A48A6A97CCA791C34935E4C02BBB1BEC1C&from=zh-cn&to=ru&text=" + textstr;
byte[] bystr = web.DownloadData(uri);
string urldata = System.Web.HttpUtility.UrlDecode(bystr, Encoding.UTF8);
return urldata;
}
}
}