导航:首页 > 源码编译 > 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网页源码所有链接相关的资料

热点内容
qt编程入门pdf下载 浏览:780
java编程的三个步骤 浏览:772
s点b点主图源码 浏览:434
电脑可以删除的临时文件夹 浏览:7
小杜app上怎么启用 浏览:305
为什么服务器喇叭喊了一次就不行 浏览:480
phpdbo驱动 浏览:255
程序员寻找转行建议 浏览:632
psgrepjava 浏览:415
梦幻诛仙12职业变态源码 浏览:370
汽车的控制是怎么编程的 浏览:686
稳定的ip地址服务器 浏览:641
python多线程编程教程 浏览:252
笔记本编程电脑排行榜 浏览:32
微信好友缓存文件在哪个文件夹 浏览:614
javafloat小数点后两位小数 浏览:166
澳门pdf 浏览:409
es解压文件默认路径 浏览:833
jar命令war包 浏览:121
福州交警app预约在哪里签字确认 浏览:623