當前位置:首頁 » 操作系統 » vb讀取網頁源碼

vb讀取網頁源碼

發布時間: 2023-08-03 05:57:39

❶ 如何用vb webbrowser獲取帶框架網頁的全部源代碼

用vb webbrowser獲取帶框架網頁的全部源代碼,指令如下:

WebBrowser1.Document.frames(0).Document.documentElement.outerHTML

遍歷框架就可以得到所有的(WebBrowser1.Document.frames(0).count框架個數)。

❷ 請問如何用VB獲取網頁源碼

使用Inet控制項獲取網頁源碼。

Internet Transfer 控制項實現了兩種廣泛使用的 Internet 協議: 超文本傳送協議(HyperText Transfer
Protocol)(HTTP) 和文件傳送協議(File Transfer Protocol) (FTP)。使用 Internet Transfer
控制項可以通過 OpenURL 或 Execute 方法連接到任何使用這兩個協議的站點並檢索文件。

PrivateSubCommand1_Click()
DimstrhtmlAsString
DimSTRURLAsString
STRURL="http://www..com"
strhtml=Inet1.OpenURL(STRURL)
Text1=strhtml
EndSub

❸ vb 快速的取得網頁源碼和提取其中內容

如下函數可以實現你要的功能:
Function TestRegExp(ByVal myString$, ByVal myPattern$, Optional myMark$ = "gimt", Optional myRepString$)
If myString = "" Or myPattern = "" Then
TestRegExp = ""
Debug.Print "數據不能為空"
Exit Function
End If
'Create objects.
Dim objRegExp As RegExp
Dim objMatch As Match
Dim colMatches As MatchCollection
Dim RetStr As String

Set objRegExp = New RegExp
' 正則式
objRegExp.Pattern = myPattern
'IIf(InStr(myPattern, "s") <> 0, "", myPattern)

' 是否區分大小寫
objRegExp.IgnoreCase = IIf(InStr(LCase$(myMark), "i") > 0, True, False)

' 是否全局
objRegExp.Global = IIf(InStr(LCase$(myMark), "g") > 0, True, False)

' 是否換行
objRegExp.MultiLine = IIf(InStr(LCase$(myMark), "m") > 0, True, False)
If objRegExp.Test(myString) Then
If InStr(myMark, "r") > 0 Then
Debug.Print "正在替換"
RetStr = objRegExp.Replace(myString, myRepString)
Debug.Print IIf(RetStr <> "", "替換結果" & Left(RetStr, 10), "沒搜索到可替換字元")
Else
Debug.Print "正在搜索"
Set colMatches = objRegExp.Execute(myString) ' Execute search.
'MsgBox colMatches.Count
For Each objMatch In colMatches ' Iterate Matches collection.
'RetStr = RetStr & objMatch.FirstIndex
RetStr = RetStr & objMatch.Value & vbCrLf
Next
Debug.Print IIf(RetStr <> "", "搜索結果" & Left(RetStr, 10), "沒搜索到匹配結果")
End If
Else
RetStr = ""
Debug.Print "沒找到任何匹配結果,請檢查正則式的是否正確"
End If
TestRegExp = RetStr
End Function

❹ VB 獲取網頁源碼 你的這個是怎麼解決的.能和我說一下嗎.謝謝

1、提取:用這個vb小程序可以!

熱點內容
tcl編譯器 發布:2025-03-13 23:52:59 瀏覽:321
linuxnamed 發布:2025-03-13 23:45:29 瀏覽:361
阿里雲30元伺服器 發布:2025-03-13 23:21:25 瀏覽:350
pythonstatvfs 發布:2025-03-13 23:14:55 瀏覽:953
火車上有密碼多少 發布:2025-03-13 23:14:10 瀏覽:865
解壓火柴 發布:2025-03-13 22:46:39 瀏覽:336
開機密碼在哪裡存著 發布:2025-03-13 22:27:22 瀏覽:952
光流場演算法 發布:2025-03-13 21:35:51 瀏覽:895
免編程軸控 發布:2025-03-13 21:19:24 瀏覽:780
新買的車都要配置哪些 發布:2025-03-13 20:42:50 瀏覽:901