日期:2014-05-20 浏览次数:20880 次
StreamReader sr = null;
HttpWebResponse response = null;
HttpWebRequest request = null;
Stream instream = null;
CkCollect = null;
Encoding encoding = Encoding.UTF8; ;
string content = "";
Waiturl += ConvertDateTimeInt(DateTime.Now);
try
{
Waiturl = Waiturl.Replace("TempTime", "1393299987118");
request = WebRequest.Create(Waiturl) as HttpWebRequest;
request.Timeout = 10000;
request.Accept = "*/*";
request.KeepAlive = true;
request.UserAgent = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.11 Safari/537.36";
request.Referer = referurl;
request.Headers.Add("Accept-Encoding", "gzip,deflate,sdch");
request.Headers.Add("Accept-Charset", "GBK,utf-8;q=0.7,*;q=0.3");
request.Headers.Add("Accept-Language", "zh-CN,zh;q=0.8");
request.CookieContainer = ck;
response = (HttpWebResponse)request.GetResponse();
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();