重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
1)使用MICROSOFT INTERNET TRANSFER CONTROL的,代码如下:
为企业提供做网站、成都网站建设、网站优化、营销型网站、竞价托管、品牌运营等营销获客服务。成都创新互联拥有网络营销运营团队,以丰富的互联网营销经验助力企业精准获客,真正落地解决中小企业营销获客难题,做到“让获客更简单”。自创立至今,成功用技术实力解决了企业“网站建设、网络品牌塑造、网络营销”三大难题,同时降低了营销成本,提高了有效客户转化率,获得了众多企业客户的高度认可!
Dim strhtml As String
Dim STRURL As String
STRURL=""
strhtml = Inet1.OpenURL(STRURL)
2)用System.Net命空间下的HttpWebRequest来取得,代码如下:
Dim url As String=" " ' 网址
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 url As String=" 网址"
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就是网页源代码
使用webbrowser控件来加载网页,然后再 Private Sub WebBrowser1_DocumentCompleted下通过使用WebBrowser1.Document.Body.InnerHtml 来获取网页的源代码,或使用 WebBrowser1.Document.Body.InnerText来获取网页中的文本。之后可以通过字符串控制指令或者正则表达式来精确获取到你所需的数据。