日期:2014-05-20 浏览次数:21066 次
byte[] data = encoding.GetBytes(rushdata);
request = WebRequest.Create(PostUrl) as HttpWebRequest;//************
request.Method = "POST";
request.ContentLength = rushdata.Length;
request.Timeout = 20000;
request.Accept = "*/*";
request.Headers.Add("X-Requested-With", "XMLHttpRequest");
request.UserAgent = UA;
request.ContentType = "application/x-www-form-urlencoded";
request.Referer = ReferUrl;
request.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
request.Headers.Add("Accept-Charset", "GBK,utf-8;q=0.7,*;q=0.3");
request.CookieContainer = PostCookie;
request.Proxy = new WebProxy(_ip, int.Parse(_port));//使用代理
outstream = request.GetRequestStream();
outstream.Write(data, 0, rushdata.Length);
outstream.Close();
response = request.GetResponse() as HttpWebResponse;
instream = response.GetResponseStream();
if (response.ContentEncoding != null && response.ContentEncoding.Equals("gzip", StringComparison.InvariantCultureIgnoreCase))
sr = new StreamReader(new GZipStream(instream, CompressionMode.Decompress), encoding);
else
sr = new StreamReader(response.GetResponseStream(), encoding);
content = sr.ReadToEnd();