扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
Imports System.Net
覃塘网站制作公司哪家好,找创新互联建站!从网页设计、网站建设、微信开发、APP开发、响应式网站设计等网站项目制作,到程序开发,运营维护。创新互联建站2013年开创至今到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联建站。
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
在发送页面用get:如点击button时response.redirect("接收页的url"?canshu=textbox.text)
;
然后在接收页面用Request.QueryString["canshu"].toString(); 这样就接受到textbox里的值了。
'GET数据通用模板,返回源码
Function DownBitmap(ByVal URL_Post As String, ByVal Referer_Post As String, ByVal Accept_Post As String, ByVal UserAgent_Post As String _
, ByVal KeepAlive_Post As Boolean, ByVal CookieContainer_Post As CookieContainer) As Bitmap
Dim HttpPostUrl As New System.Uri(URL_Post)
Dim reqp As HttpWebRequest
reqp = CType(WebRequest.Create(HttpPostUrl), HttpWebRequest)
reqp.Method = "GET"
reqp.Referer = Referer_Post
reqp.Accept = Accept_Post
reqp.UserAgent = UserAgent_Post
reqp.KeepAlive = KeepAlive_Post
reqp.CookieContainer = CookieContainer_Post '设置Cookie
Dim resP As WebResponse = reqp.GetResponse
Dim bmp As Bitmap = New Bitmap(resP.GetResponseStream)
resP.Close() '关闭
Return bmp
End Function
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就是网页源代码
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流