|
经过大师指点,弄了个粗人版,大师的那个钩子一时无法吸收。
Sub try()
Dim Xml
Dim picAry() As Byte
Dim vf As String
Set Xml = CreateObject("Microsoft.XMLHTTP")
Xml.Open "GET", "http://www.zhima.cc/member/inc/getcode.asp", False
Xml.Send
picAry = Xml.responseBody
Call WriteBinary(ThisWorkbook.Path & "\verycode.gif", picAry)
Do Until Dir(ThisWorkbook.Path & "\verycode.gif") <> ""
DoEvents
Loop
ActiveSheet.Cells(2, 2).Select
Set vCode = ActiveSheet.Pictures.Insert(ThisWorkbook.Path & "\verycode.gif")
vCode.ShapeRange.ScaleWidth 3, msoFalse, msoScaleFromTopLeft
vCode.ShapeRange.ScaleHeight 3, msoFalse, msoScaleFromTopLeft
ActiveSheet.Cells(2, 1).Select
vf = InputBox("输入左上角的验证码")
'ActiveSheet.Shapes(vCode.Name).Delete
vCode.Delete
Xml.Open "POST", "http://www.zhima.cc/member/login.asp", False
Xml.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Xml.Send "user_id=9375204@163.com&user_password=369852&GetCode=" + vf + "&tourl=&Submit.x=69&Submit.y=20"
Xml.Open "GET", "http://www.zhima.cc/home.asp", False
Xml.Send
pt Xml.ResponseText, 1
Xml.Open "GET", "http://www.zhima.cc/game/luckynums/", False
Xml.Send
pt Xml.ResponseText, 2
MsgBox "ok"
End Sub
Sub pt(s, n)
Open ThisWorkbook.Path + "\" & n & ".htm" For Output As #1
Print #1, s
Close #1
End Sub
Sub WriteBinary(FileName As String, aBuf As Variant)
Dim I, bStream
Set bStream = CreateObject("ADODB.Stream")
bStream.Type = 1: bStream.Open
With CreateObject("ADODB.Stream")
.Type = 2: .Open: .WriteText aBuf
.Position = 2: .CopyTo bStream: .Close
End With
bStream.SaveToFile FileName, 2: bStream.Close
Set bStream = Nothing
End Sub
|
|