VB如何提取网页内容

来源:百度知道 编辑:UC知道 时间:2024/06/23 01:10:05
VB提取网页内容

'读取文件内容可以用:
content=readFile("c:\abc.txt")

Function readFile(ByVal filePath As String) As String
Dim b() As Byte, f As Long
On Error Resume Next
f = FreeFile
Open filePath For Binary As #f
If LOF(f) > 0 Then ReDim b(1 To LOF(f)) As Byte
Get #f, , b
Close f
readFile = StrConv(b, vbUnicode) '返回文件内容
End Function

然后把content变量拿来提取<和>之间的内容。建议用正则表达试提取,更高效快速。