2个回答
展开全部
1)使用MICROSOFT INTERNET TRANSFER CONTROL的,代码如下:
Dim strhtml As String
Dim STRURL As String
STRURL="http://www.sijiqing.com"
strhtml = Inet1.OpenURL(STRURL)
2)用System.Net命空间下的HttpWebRequest来取得,代码如下:
Dim url As String=" http://mgxx520.blog.com.cn" ' 网址
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与 Internet资源建立持久连接。
Dim reader As StreamReader = _
New StreamReader(httpResp.GetResponseStream,
System.Text.Encoding.GetEncoding(-0))
Dim respHTML As String = reader.ReadToEnd() 'respHTML就是网页源代码.
Dim strhtml As String
Dim STRURL As String
STRURL="http://www.sijiqing.com"
strhtml = Inet1.OpenURL(STRURL)
2)用System.Net命空间下的HttpWebRequest来取得,代码如下:
Dim url As String=" http://mgxx520.blog.com.cn" ' 网址
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与 Internet资源建立持久连接。
Dim reader As StreamReader = _
New StreamReader(httpResp.GetResponseStream,
System.Text.Encoding.GetEncoding(-0))
Dim respHTML As String = reader.ReadToEnd() 'respHTML就是网页源代码.
展开全部
Private Sub Command1_Click()
Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP")
xmlHTTP1.Open "get", "http://www.baidu.com", True
xmlHTTP1.send
While xmlHTTP1.readyState <> 4
DoEvents
Wend
Text1.Text = xmlHTTP1.responseText
Set xmlHTTP1 = Nothing
End Sub
加入text
Set xmlHTTP1 = CreateObject("Microsoft.XMLHTTP")
xmlHTTP1.Open "get", "http://www.baidu.com", True
xmlHTTP1.send
While xmlHTTP1.readyState <> 4
DoEvents
Wend
Text1.Text = xmlHTTP1.responseText
Set xmlHTTP1 = Nothing
End Sub
加入text
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |