扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
Imports System.Net
在宕昌等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站制作、成都网站设计、外贸营销网站建设 网站设计制作定制网站建设,公司网站建设,企业网站建设,成都品牌网站建设,网络营销推广,外贸营销网站建设,宕昌网站建设费用合理。
Imports System.IO
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim stream As IO.Stream = WebRequest.Create(UrlAdress).GetResponse().GetResponseStream()
'注意urladress为你上面的网页地址。
Dim sr As StreamReader = New StreamReader(stream, System.Text.Encoding.UTF8)
Label1.Text = Regex.Match(sr.ReadToEnd, "回答采纳率").ToString
'sr。readtoend读取网页流到末尾,即使用正则表达式从网页流中提取“回答采纳率”,赋值给Label1.Text ‘没有则为空
sr.Dispose() '关闭流
End Sub'要提取什么东西用正则表达式最好
End Class
System.Diagnostics.Process.Start("")
或者用 WebBrowser控件,代码 WebBrowser1.Url = New System.Uri("")
(转自网络)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
WebBrowser1.Navigate("")
End Sub
Private Sub WebBrowser1_DocumentTitleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebBrowser1.DocumentTitleChanged
Me.Text = WebBrowser1.Document.Url.ToString
End Sub
'******************************
'函数名:GetHtml
'作 用:读取其他网站页面内容
'参 数:Url是要读取的网站地址
'返回值:读取后的网站内容
'******************************
Function GetHtml(ByVal Url As String, ByVal bm As String) As String
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(Url)
Dim respHTML As String = ""
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
Try
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与 Internet资源建立持久连接。
Dim reader As StreamReader = New StreamReader(httpResp.GetResponseStream, System.Text.Encoding.GetEncoding(bm))
respHTML = reader.ReadToEnd() 'respHTML就是网页源代码
Catch
respHTML = "zhongduan"
End Try
Return respHTML
End Function
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流