@H_301_0@首先,先建立一个工程,加一个窗体form1,上面添加一个textBox控件text1,和两个按钮
分别为command1和command2,
然后实现按下command1按钮就向网页提交text1的内容
先打开菜单里的,工程-〉引用-〉选中microsoft xml,必须先这样,因为下面要用到msxml对象
button1的实现代码如下:
Private Sub Command1_Click()
On Error Resume Next
Dim oXmlHttp As New MSXML.XMLHTTPRequest
Dim sPostString As String,sRespText As String
@H_301_0@sPostString = "ID = " + Text1.Text '需要提交的数据"
oXmlHttp.open "POST","http://127.0.0.1",False
@H_301_0@'一定要加上下面的这一句,说明提交类型的
oXmlHttp.setRequestHeader "content-type","application/x-www-form-urlencoded "
"
oXmlHttp.send (sPostString)
sRespText = oXmlHttp.responseText '得到处理后response回来的数据
'sRespText为返回的结果,可以根据结果进行处理,具体处理请根据需要编写
oXmlHttp = Nothing
End Sub
@H_301_0@Private Sub Command1_Click()
Inet1.Execute "http://localhost/test/recevie.asp","post","info=" + Text1.Text,"Content-Type: application/x-www-form-urlencoded "
Do While Inet1.StillExecuting
DoEvents
Loop
Text2.Text = Inet1.GetChunk(1024,icString)
@H_301_0@MsgBox ("yes")
@H_301_0@End Sub
@H_301_0@vb提取验证码
@H_301_0@
@H_301_0@Option Explicit
Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.m5home.com/blog/login.asp"
End SubPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object,URL As Variant) If URL <> "" Then Dim Img As Object,CR As Object Set Img = WebBrowser1.Document.getElementById("vcodeImg") '根据验证码的ID取得这个对象 Set CR = WebBrowser1.Document.body.createControlRange() '设置选区 CR.Add Img '添加验证码图片对象到选区 CR.execCommand ("Copy") '复制 Set Picture1.Picture = Clipboard.GetData() '粘贴过去 End IfEnd Sub