本帖最后由 gfuchao 于 2012-3-5 01:30 编辑 #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include "WinHttp.au3"
Opt("MustDeclareVars", 1)
; !!!注意,如果用户名和密码无效,这个例子将失败!!!
; 认证数据
Global $sUsername = "***"
Global $sPassword = "***"
; 地址
Global $sAddress = "www.qqtz.com"
; 初始化并获得会话句柄
Global $hOpen = _WinHttpOpen()
; 获取连接句柄
Global $hConnect = _WinHttpConnect($hOpen, $sAddress)
; 请求
Global $hRequest = _WinHttpOpenRequest($hConnect, _
"POST", _ ; 动词
"/login.php", _ ; 目标
Default, _ ; 版本
"http://www.qqtz.com/login.php", _ ; 提交
"*/*") ; 接受
; 发送
_WinHttpSendRequest($hRequest, _
"Content-Type: application/x-www-form-urlencoded" & @CRLF, _
"jumpurl=http%3A%2F%2Fwww.qqtz.com%2Findex.php&step=2&cktime=31536000&lgt=0&a69b1c6fadd69e15bb04981e2a5e5df9="&$sUsername&"&7a48008766dcc22961b31fe9ce73928c="&$sPassword&"&question=0&customquest=&answer=")
; 等待响应
_WinHttpReceiveResponse($hRequest)
Global $sHeader = _WinHttpQueryHeaders($hRequest)
ConsoleWrite($sHeader & @CRLF)
; 关闭打开的句柄并退出
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
POST /login.php HTTP/1.1
Accept: application/x-shockwave-flash, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Referer: http://www.qqtz.com/
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: www.qqtz.com
Content-Length: 189
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: 3c44b_lastvisit=13%091330706905%09%2Flogin.php%3F; 3c44b_lastpos=other; 3c44b_olid=322; wmakey=ssjj; CNZZDATA2807041=cnzz_eid=60608553-1330706893-&cnzz_a=2&retime=1330706908764&sin=<ime=1330706908764&rtime=0
jumpurl=http%3A%2F%2Fwww.qqtz.com%2Findex.php&step=2&cktime=31536000&lgt=0&a69b1c6fadd69e15bb04981e2a5e5df9=***&7a48008766dcc22961b31fe9ce73928c=***&question=0&customquest=&answer=
http://www.qqtz.com/login.php
返回的这些信息到底是登陆成功了还是没有成功呐? |