导航:首页 > 源码编译 > vbnet网页源码所有链接

vbnet网页源码所有链接

发布时间:2024-10-17 16:56:39

㈠ 用VB.NET载入网页源码中的字符

'首先用webclient获得贴吧首页的源码。这里以vb,net贴吧为例
Private Sub BtnGetNum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGetNum.Click
Dim url As String = "http://tieba..com/f?kw=vb.net"'vb.net吧的首页
Dim MyClient As System.Net.WebClient = New System.Net.WebClient
Dim MyReader As New System.IO.StreamReader(MyClient.OpenRead(url), System.Text.Encoding.Default) '定义新的文件流并读取网页文件数据
Dim longTxt As String = MyReader.ReadToEnd '写入
'分析源码,获取主题数
Dim startStr As String = "共有主题数"
Dim startNum As Long = InStr(longTxt, startStr) + Len(startStr) + 18
Dim resStr As String = ""
Do Until Mid(longTxt, startNum, 1) = “<"
resStr = resStr & Mid(longTxt, startNum, 1)
startNum = startNum + 1
Loop
Label1.Text = resStr '显示主题数
End Sub

㈡ 如何用vb.net获得网页的源代码

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就是网页源代码

阅读全文

与vbnet网页源码所有链接相关的资料

热点内容
如何更换文件夹的格式 浏览:529
openssl不是内部或外部命令 浏览:759
西方经济学宏观pdf 浏览:21
comp命令分析 浏览:521
什么app可以看隧道 浏览:155
文件夹两份相同 浏览:100
python123手机怎么弄 浏览:466
如何判断柯力d2008仪表有没有加密 浏览:930
miui加密状态 浏览:326
闪讯无法解析服务器的dns地址 浏览:48
java创建json 浏览:786
奥特曼传奇如何获取服务器时间 浏览:7
苹果用的服务器叫什么 浏览:490
程序员头发脱落 浏览:494
javafont颜色 浏览:156
加密失败20是什么意思 浏览:693
php随机读取行 浏览:505
测试程序员分哪几种 浏览:580
三星手机检测命令 浏览:425
08款飞度压缩比 浏览:259