如何用vb语言获得IE游览器当前打开网页的源代码,并保存
1个回答
展开全部
直接获取即可
'//////////////////////////////////////获取网络源码////////////////////////////// URL 网址, Code 网页编码
Public Function GetPage$(url$, code$)
On Error Resume Next
Dim Retrieval As Object
Set Retrieval = Nothing
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.open "Get", url, True, "", ""
.setRequestHeader "If-Modified-Since", "0"
.setRequestHeader "Cache-Control", "no-cache"
.setRequestHeader "Connection", "close"
.send
While .ReadyState <> 4
DoEvents
Wend
GetPage = BM(.ResponseBody, code)
End With
Set Retrieval = Nothing
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询