public static string func_fetch_Page(string srUrl, int irTimeOut = 60, string srRequestUserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0", string srProxy = null) { string srBody = ""; string srResult = ""; try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(srUrl); request.Timeout = irTimeOut * 1000; request.UserAgent = srRequestUserAgent; request.KeepAlive = true; request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; WebHeaderCollection myWebHeaderCollection = request.Headers; myWebHeaderCollection.Add("Accept-Language", "en-gb,en;q=0.5"); myWebHeaderCollection.Add("Accept-Encoding", "gzip, deflate"); request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; using (WebResponse response = request.GetResponse()) { using (Stream strumien = response.GetResponseStream()) { using (StreamReader sr = new StreamReader(strumien)) { srBody = sr.ReadToEnd(); srResult = "success"; } } } } catch () { } return srBody; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)