以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 求助:获取网页代码怎么获取Web浏览器中网页的代码呢? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=92352) |
-- 作者:李孝春 -- 发布时间:2016/11/1 16:14:00 -- 求助:获取网页代码怎么获取Web浏览器中网页的代码呢? 下面是直接输入地址之后对应的获取网页源码的代码: Dim url As String = "http://toutiao.com/m6051259851/" try Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url) rqst.TimeOut = 1000 \'一秒 Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse Dim stm As System.IO.Stream = rsps.GetResponseStream() Dim reader As New System.IO.StreamReader(stm) Dim str As String = reader.ReadToEnd stm.Dispose() Output.Show(str) catch ex As exception msgbox(ex.Message) End try 现在怎么变通实现获取窗体中Web浏览器已经打开的网页的源码呢? |
-- 作者:有点蓝 -- 发布时间:2016/11/1 17:37:00 -- Dim web = e.Form.Controls("WebBrowser1").BaseControl Output.Show(web.Document.body.Innerhtml) http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=32808 |