HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url); HttpWebResponse webResponse = (System.Net.HttpWebResponse)webRequest.GetResponse(); Stream streamReceive = webResponse.GetResponseStream(); if (webResponse.ContentEncoding.ToLower().Contains("gzip")) { //gzip格式 streamReceive = new GZipStream(streamReceive, CompressionMode.Decompress); } using (System.IO.StreamReader sr = new System.IO.StreamReader(streamReceive, encoding)) { responseData = sr.ReadToEnd(); }
时间: 2024-11-08 21:19:58