VB6.0: 求获取某个网页所有HTML的代码

2025-03-04 09:39:57
推荐回答(5个)
回答1:

'使用 URLDownloadToFile 这个API可以实现你想要的功能。
'声明API函数
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" ( _
                                                            ByVal pCaller As Long, _
                                                            ByVal szURL As String, _
                                                            ByVal szFileName As String, _
                                                            ByVal dwReserved As Long, _
                                                            ByVal lpfnCB As Long _
                                                            ) As Long
'下载网页源码
Public Function DownloadFile(ByVal strURL As String, ByVal strFile As String) As Boolean
   Dim lngReturn                   As Long
   
   lngReturn = URLDownloadToFile(0, strURL, strFile, 0, 0)
   If lngReturn = 0 Then DownloadFile = True
End Function
Private Sub Command1_Click()
   Debug.Print DownloadFile("http://zhidao.baidu.com/question/12376048.html", "D:\1.html")
End Sub


或者使用WinHTTP、XMLHTTP对象

回答2:

用狐火浏览器打开网站 点击右键 另存为,保存全部网页。

回答3:

直接按字符流读取文件就好了啊

回答4:

百度上找仿站小工具 可以直接下载包括代码 css js 和图片

回答5:

可以介绍给你一个工具,单页扒手工具。