你如果是 C# 开发 w inform 话 WebBrowser 这个控件是很好用的!! 里面的很多属性 可以方便的让你 得到网页上的信息 网页地址 WebBrowser.Url = new uri("http://www.zgjrjw.com/index.shtml");网页内容 this.webBrowser.DocumentText 或者里面的连接 COOKIE 都可以得到很实用
WebRequest wReq = WebRequest.Create(site); // Set the HTTP-specific UserAgent property if (wReq is HttpWebRequest) { ((HttpWebRequest)wReq).UserAgent = ".NET Framework Example Client"; } // Get the response instance WebResponse wResp = wReq.GetResponse(); // Read an HTTP-specific property. if (wResp is HttpWebResponse) { DateTime updated = ((HttpWebResponse)wResp).LastModified; } // Get the response stream. Stream respStream = wResp.GetResponseStream(); // This example uses a StreamReader to read the entire response // into a string and then writes the string to the console. StreamReader reader = new StreamReader(respStream, Encoding.ASCII); String respHTML = reader.ReadToEnd(); Console.WriteLine(respHTML); // Close the response and response stream. wResp.Close();
WebRequest
WebResponse
里面的很多属性 可以方便的让你 得到网页上的信息
网页地址 WebBrowser.Url = new uri("http://www.zgjrjw.com/index.shtml");网页内容 this.webBrowser.DocumentText
或者里面的连接 COOKIE 都可以得到很实用
if (wReq is HttpWebRequest)
{
((HttpWebRequest)wReq).UserAgent =
".NET Framework Example Client";
} // Get the response instance
WebResponse wResp = wReq.GetResponse(); // Read an HTTP-specific property.
if (wResp is HttpWebResponse)
{
DateTime updated = ((HttpWebResponse)wResp).LastModified;
} // Get the response stream.
Stream respStream = wResp.GetResponseStream(); // This example uses a StreamReader to read the entire response
// into a string and then writes the string to the console.
StreamReader reader =
new StreamReader(respStream, Encoding.ASCII);
String respHTML = reader.ReadToEnd();
Console.WriteLine(respHTML); // Close the response and response stream.
wResp.Close();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
WebResponse recevieRes = sendReq.GetResponse();Stream receviceStream = recevieRes.GetResponseStream();
Encoding encode = Encoding.GetEncoding("utf-8");
StreamReader reader = new StreamReader(receviceStream, encode);