//Get the request from the web server(s) HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(m_sURLToProcess); WebResponse myResponse = myReq.GetResponse();
//Get the data from the stream int iContentLength; ArrayList sTotalBuffer = new ArrayList(); if (myResponse.ContentLength >= 0) { //********************* Take care of if the Content Length can be found (if the string can be seeked) iContentLength = (int)myResponse.ContentLength; } else { //********************* Take care of if the Content Length cannot be found (if the string can't be seeked) iContentLength = 1024; } BinaryReader br = new BinaryReader(myResponse.GetResponseStream()); int iTotalBytes = 0;
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(m_sURLToProcess);
WebResponse myResponse = myReq.GetResponse();
//Get the data from the stream
int iContentLength;
ArrayList sTotalBuffer = new ArrayList(); if (myResponse.ContentLength >= 0)
{
//********************* Take care of if the Content Length can be found (if the string can be seeked)
iContentLength = (int)myResponse.ContentLength;
}
else
{
//********************* Take care of if the Content Length cannot be found (if the string can't be seeked)
iContentLength = 1024;
} BinaryReader br = new BinaryReader(myResponse.GetResponseStream());
int iTotalBytes = 0;
m_iBytesRead = 1;
iTotalBytes = 0;
while (m_iBytesRead > 0)
{
byte[] sBuffer = new byte[iContentLength];
m_iBytesRead = br.Read(sBuffer, 0, iContentLength);
if (m_iBytesRead > 0)
{
for(int i=0;i<m_iBytesRead;i++)
{
sTotalBuffer.Add(sBuffer[i]);
}
iTotalBytes += (int)m_iBytesRead;
}
}
byte[] sTmp=new byte[sTotalBuffer.Count];
sTotalBuffer.CopyTo(sTmp);
string sTmpHTML;
sTmpHTML = System.Text.Encoding.GetEncoding("GB2312").GetString(sTmp);
再分析sTmpHTML 中的内容就可以了
哈哈.菜鸟的方法
using mshtml;
... HTMLDocument htmlDocument = (HTMLDocument)axWebBrowser1.Document;
if (htmlDocument != null)
{
HTMLInputElement btnSubmit = (HTMLInputElement)htmlDocument.all.item("btnSubmit", 0);
if (btnSubmit != null)
btnSubmit.click();
}