本帖最后由 drunk 于 2011-5-3 17:56 编辑
哪位帮忙看一下啊,我这个是直接用的示例,账号已经注册了,为什么登陆不成功呢
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include "WinHttp.au3"
Opt("MustDeclareVars", 1)
; !!!注意,如果用户名和密码无效,这个例子将失败!!!
; 认证数据
Global $sUsername = "idrunk"
Global $sPassword = "1397361dt"
; 地址
Global $sAddress = "space.livevn.com"
; 初始化并获得会话句柄
Global $hOpen = _WinHttpOpen()
; 获取连接句柄
Global $hConnect = _WinHttpConnect($hOpen, $sAddress)
; 请求
Global $hRequest = _WinHttpOpenRequest($hConnect, _
"POST", _ ; 动词
"/do.php?ac=091e9036ad660fc544fcb2eb3ce7be65&&ref", _ ; 目标
Default, _ ; 版本
"http://space.livevn.com/index.php", _ ; 提交
"*/*") ; 接受
; 发送
_WinHttpSendRequest($hRequest, _
"Content-Type: application/x-www-form-urlencoded" & @CRLF, _
"username="&$sUsername&"&password="&$sPassword&"&cookietime=315360000&refer=%2F&abc=&loginsubmit=%C4%90%C4%83ng+nh%E1%BA%ADp+&formhash=984798db")
; 等待响应
_WinHttpReceiveResponse($hRequest)
; 看看有返回什么
If _WinHttpQueryDataAvailable($hRequest) Then
Global $sHeader = _WinHttpQueryHeaders($hRequest)
ConsoleWrite($sHeader & @CRLF)
; 检查是否给予适当的 cookie
If StringInStr($sHeader, 'Set-Cookie: uchome_loginuser=' & $sUsername) Then
MsgBox(0, "", "登录成功")
Else
MsgBox(0, "", "登录失败")
EndIf
Else
MsgBox(48, "错误", "网站遇到的问题.")
EndIf
; 关闭打开的句柄并退出
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
|