網頁抓取的方式
Dim url = "http://www.235.com.tw/"
Dim webreq As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(url), _
System.Net.HttpWebRequest)
webreq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0)"
webreq.Headers.Set("Cookie", "B=4mobkah16s4f2&b=2; Q=q1=AACAAAAAAAAAAA--&q2=Qm6Gcg--; EPDOFzX=t=1\r\n")
Dim webres As System.Net.HttpWebResponse = _
CType(webreq.GetResponse(), System.Net.HttpWebResponse)
Dim mystream As System.IO.Stream = webres.GetResponseStream()
Dim buf(10000000) As Byte
mystream.Read(buf, 0, 10000000)
Me.TextBox1.Text = System.Text.Encoding.Default.GetString(buf)
mystream.Close()
Hi,
亂馬客Blog已移到了 「亂馬客 : Re:從零開始的軟體開發生活」
請大家繼續支持 ^_^