VB6下载网页源码

Ben*_*Ben 5 vb6 webclient

在VB6中有没有办法将网页源下载到字符串或文本框?例如在VB.Net中,WebClient类允许你使用.DownloadString("google.com")这样做,我怎样才能在vb6中做同样的事情?

注意:我想避免使用WebBrowser.

var*_*ant 4

我对VB6不太了解,但是在VBA中......

Dim objHttp As Object, strURL as string, strText as string

Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")

strURL = "http://www.yoursite.com/"

objHttp.Open "GET", strURL, False
objHttp.setRequestHeader "User-Agent", _
  "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
objHttp.Send ("")

strText = objHttp.responseText

Set objHttp = Nothing
Run Code Online (Sandbox Code Playgroud)