给你一个自动登录的代码#include <IE.au3>
Func _Post_Login($Name,$Pass)
$oHTTP = ObjCreate("Msxml2.xmlhttp")
$oHTTP.Open("Post","http://www.autoitx.com/logging.phpaction=login",false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
$oHTTP.setRequestHeader("Referer","http://www.autoitx.com")
$oHTTP.Send('sid=dJ6jji&formhash=aa9fb561&referer=&cookietime=2592000&loginfield=username&username=' & $Name & '&password=' & $Pass & '&questionid=0&answer=&loginsubmit=%BB%E1%D4%B1%B5%C7%C2%BC')
$Log = BinaryToString($oHTTP.responseBody)
$Log = _Search($Log,'<p>(.*)<script>')
MsgBox(64,"提示:",$Log)
EndFunc
Func _Search($Txt,$Condition)
Local $Result
$array = StringRegExp($Txt,$Condition, 2, 1)
for $i = 0 to UBound($array) - 1
$Result = $array[$i]
Next
Return $Result
EndFunc
$Name= "论坛的账号"
$Pass= "论坛的密码"
_Post_Login($Name,$Pass)
_IECreate ("http://www.autoitx.com/",1,1,0)
|