经过我试验发现,QQ更改了登陆验证方式,需要两次请求,并且第一次会在浏览器存储 session,因此批处理无法实现这个登陆了。
而在测试用 VBS 自动登录时,发现他有时候有验证码,有时候又没有,暂时理解为网速慢的时候有验证码,需要手动输入才行,乳沟没有的话就自动登陆了,下面是代码:- QQWebLogin "QQ校友", "88888888", "mima123456"
-
- '* 默认支持 "QQ空间"、"QQ校友"、"城市达人"。
- '* 其它请自己添加。
- '*----------------------------------------------
- Function QQWebLogin(Target, QQNumber, Password)
- Dim URL, URLMapping
- Set URLMapping = CreateObject("Scripting.Dictionary")
- URLMapping.Add "QQ空间", "http%3A%2F%2Fuser.qzone.qq.com%2F" & QQNumber
- URLMapping.Add "QQ校友", "http%3A%2F%2Fxiaoyou.qq.com%2F"
- URLMapping.Add "城市达人", "http%3A%2F%2Fcity.qq.com%2F"
- Items = URLMapping.Items
- URL = Items(0)
- If URLMapping.Exists(Target) Then URL = URLMapping.Item(Target)
- URL = "http://ui.ptlogin2.qq.com/cgi-bin/login?" & _
- "link_target=blank&appid=15000101&hide_title_bar=1&no_verifyimg=1&s_url=" & _
- URL & "&f_url=loginerroralert&target=top&qlogin_jumpname=jump" & _
- "&qlogin_param=u1%3Dhttp%3A//qzone.qq.com/new.html&ptcss=0"
- With CreateObject("InternetExplorer.Application")
- .Navigate URL
- Do Until .ReadyState = 4
- WScript.Sleep 421
- Loop
- Set img = .document.getElementsByTagName("img")(0)
- .document.all.u.value = QQNumber
- WScript.Sleep 421
- .document.all.p.value = Password
- WScript.Sleep 421
- If Not Len(img.src) > 17 Then
- .document.all.login_button.click
- WScript.Sleep 421
- End If
- .Visible = True
- End With
- End Function
复制代码
|