1.vb ?网页?ҳģ?????Դ??
2.vb.net如何使用HttpWebRequest模拟登陆带验证码的网站
vb ??ҳģ?????Դ??
'你把下面的代码保存为Form1.frm,然后双击打开该文件,模拟运行后按提示即可看到结果。操作
'呵呵,源码页云信的im通讯源码够详细了,做网再不会我也没办法了。网页ictcla源码
'====文件Form1.frm====
VERSION 5.
Begin VB.Form Form1
Caption = "Form1"
ClientHeight =
ClientLeft =
ClientTop =
ClientWidth =
LinkTopic = "Form1"
ScaleHeight =
ScaleWidth =
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text2
Height =
Left =
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 2
Top =
Width =
End
Begin VB.TextBox Text1
Height =
Left =
TabIndex = 1
Text = "我的模拟家"
Top =
Width =
End
Begin VB.CommandButton Command1
Caption = "获取HTML源码"
Height =
Left =
TabIndex = 0
Top =
Width =
End
Begin VB.Label Label2
Caption = "注意:获取源码之前必须先用IE打开网址,然后输入窗口标题关键字。操作如www..com的源码页标题关键字是:我的家"
Height =
Left =
TabIndex = 4
Top =
Width =
End
Begin VB.Label Label1
Caption = "请输入IE窗口标题:"
Height =
Left =
TabIndex = 3
Top =
Width =
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Function GetIeHtml(IeTitle As String) As String
Dim oShellApp: Set oShellApp = CreateObject("Shell.Application")
Dim oShellAppWindows: Set oShellAppWindows = oShellApp.Windows
Dim owin
'获取弹出的IE窗口
For Each owin In oShellAppWindows '获取弹出的IE窗口
If LCase(TypeName(owin.Document)) = "htmldocument" And _
InStr(1, owin.LocationName, IeTitle, vbTextCompare) > 0 Then '如果找到符合条件的IE窗口
GetIeHtml = owin.Document.activeElement.Document.documentElement.innerHTML '此句可获得完整html代码
GoTo Mend '退出
End If
Next
Mend:
Set oShellAppWindows = Nothing
Set oShellApp = Nothing
Set owin = Nothing
End Function
Private Sub Command1_Click()
Dim S As String
S = GetIeHtml(Text1.Text) '表示获得标题含有"我的家"的html代码
Text2.Text = S
End Sub
Private Sub Form_Load()
'Shell "explorer.exe ""/""", vbNormalNoFocus
End Sub
vb.net如何使用HttpWebRequest模拟登陆带验证码的网站
一般登陆网站时候首先要打开一个网页对吧?
那首先要 GET 一个网址。GetResponse后,做网得到的网页流就是这个页面的源码。
源码里肯定会包含这个验证码的模拟提问段(可能是个的网址,也可能是操作diyce源码个 5+5=? 之类的字符串之类的),可以分析一下这段代码出现的源码页位置,让程序自动寻找。做网找到这个的专家 源码网址,把这个 GET 下来,然后,就是kmspico 源码orc识别或你人工识别咯。。。