vb2010获取网页源码的函数
时间:2014-07-24 | 作者:本站整理 | 阅读:829vb2010获取网页源码的函数如下:
Function posthtml(ByVal _URL As String) As String
Dim TitelStart, TitelEnd As Short
Dim TitelTxt As String
Dim url As String = _URL ' 网页地址
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(Net.HttpWebRequest.Create(httpURL), Net.HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), Net.HttpWebResponse)
Dim reader As IO.StreamReader = New IO.StreamReader(httpResp.GetResponseStream)
Dim respHTML As String = reader.ReadToEnd() 'respHTML就是网页源代码
TitelStart = respHTML.IndexOf("<title>") + 7
TitelEnd = respHTML.IndexOf("</title>")
TitelTxt = respHTML.Substring(TitelStart, TitelEnd - TitelStart)
Return TitelTxt.Trim
End Function
福利游戏
相关文章
更多精选合集
更多大家都在玩
大家都在看
更多-
- 恋与制作人许墨心悦地怎么样
- 时间:2025-01-18
-
- 恋与制作人周棋洛亲密爱人怎么样
- 时间:2025-01-18
-
- 星露谷物语农场电脑配方解锁技巧解析
- 时间:2025-01-18
-
- 星露谷物语提升运气食谱具体解析
- 时间:2025-01-18
-
- 星露谷物语运气影响因素详细一览
- 时间:2025-01-18
-
- 《碧海黑帆》发布更新档 调整玩法并修复多处BUG
- 时间:2025-01-18
-
- 闪耀暖暖扶光落九乌怎么样
- 时间:2025-01-18
-
- 王者荣耀弈星万物之道怎么样
- 时间:2025-01-18