用MSXML2.XMLHTTP提取网页源码后不知道怎么才能一行行分析源码
发布网友
发布时间:2022-04-12 12:47
我来回答
共1个回答
热心网友
时间:2022-04-12 14:16
可以这样做:VB.NET code
'获取网页源码 Public Function GetBody(priStrUrl As String, priStrMothed As String) As String Dim HtmlCode As String = "" Try Retrieval.open(priStrMothed, priStrUrl, False, "", "") Retrieval.send(Nothing) Dim b As [Byte]() = DirectCast(Retrieval.responseBody, [Byte]()) HtmlCode = System.Text.ASCIIEncoding.GetEncoding("gb2312").GetString(b, 0, b.Length) Retrieval.abort() Catch e As Exception e.ToString() Return "error" End Try Return HtmlCode End Function