vb怎么提取网页源代码的指定内容
我把网页的源文件放在了text3.text,下面是源代码里面的被一部分内容,我想把那个17467286和523990提取出来直接输入到text4.texttype=hid...
我把网页的源文件放在了text3.text,下面是源代码里面的被一部分内容,我想把那个17467286 和523990提取出来直接输入到text4.texttype=hidden
type=hidden> <INPUT id=account value=17467286
type=hidden> <INPUT id=pwd value=523990 展开
type=hidden> <INPUT id=account value=17467286
type=hidden> <INPUT id=pwd value=523990 展开
2个回答
展开全部
Dim webaddress$, info$ '定义数据类型
webaddress = "http://www.baidu.com"
info = Inet1.OpenURL(webaddress) '这个比较关键,就是下网页源代码到info
Open "C:\data.txt" For Output As #1 '把源代码保存为infobaidu文本
Print #1, info
Close #1
Open "C:\data.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, aa
astr = astr & aa
Loop
Close #1
i = InStr(astr, "搜索关键字结尾")
j = InStrRev(astr, "搜索关键字开头", i)
If i * j = 0 Then Exit Sub
Text4.Text = Mid(astr, j + 1, i - j - 1)
webaddress = "http://www.baidu.com"
info = Inet1.OpenURL(webaddress) '这个比较关键,就是下网页源代码到info
Open "C:\data.txt" For Output As #1 '把源代码保存为infobaidu文本
Print #1, info
Close #1
Open "C:\data.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, aa
astr = astr & aa
Loop
Close #1
i = InStr(astr, "搜索关键字结尾")
j = InStrRev(astr, "搜索关键字开头", i)
If i * j = 0 Then Exit Sub
Text4.Text = Mid(astr, j + 1, i - j - 1)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询