HttpWebRequest WebReq;
HttpWebResponse WebResp;
Stream Answer;
StreamReader _Answer;
string ResponseOutput;
WebReq = (HttpWebRequest)WebRequest.Create(imdb.url);
WebReq.KeepAlive = false;
WebReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4";
WebReq.Method = "GET";
WebReq.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
WebReq.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
try
{
using (WebResp = (HttpWebResponse)WebReq.GetResponse())
{
Answer = WebResp.GetResponseStream();
_Answer = new StreamReader(Answer);
ResponseOutput = _Answer.ReadToEnd();
}
}
catch (WebException ex) {return null;}
爲什麼我會翻譯成羅馬尼亞語的頁面?如果我用http://www.imdb.com/title/tt1606378/
調用此代碼,則得到的響應包含<title>Si mai greu de ucis (2013) - IMDb</title>
而不是<title>A Good Day to Die Hard (2013) - IMDb</title>
?爲什麼我會用羅馬尼亞語翻譯IMDB結果?
設置HTTP接受語言頭和ITLL工作 – Tearsdontfalls 2013-02-27 19:01:10