shano 发表于 2010-10-5 01:23:09

POST生成COOKIES的问题

刚接触POST有个问题

为何POST 咱们AUTOITX论坛就会生成1个COOKIES
而真实用IE浏览会生成2个   
用POST如何完全模拟访问论坛?



_XmlHttp("http://www.autoitx.com/thread-18793-1-1.html")
Func _XmlHttp($Url)
$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("get",$Url,false)
$oHTTP.Send()
$sReturn=BinaryToString($oHTTP.responsetext)
Return $sReturn
EndFunc

republican 发表于 2010-10-5 11:35:53

本帖最后由 republican 于 2010-10-5 11:38 编辑

本论坛的后台获取方法,刚花了一小时研究,顺带更新了自己的UDF。

我只测试了自己的用户ID,其他人未测.

需要用到的UDF: http://www.autoitx.com/thread-18528-1-1.html

#Include <ACN_HASH.au3>
#include <Array.au3>
#include <WinHttp_GetRespond.au3>

        $MyOpen=_WinHttpOpen()       
        Local $Request=["$hRequest"]

        $rContext=_WinHTTP_GetRespond($MyOpen,"http://www.autoitx.com/forum-6-1.html")
        $xzr_sid=StringRegExpReplace($rContext,"(xzr_sid.*?;).*","$1")

        $Name=InputBox("请输入用户名","你知道的")
        $PassWord=InputBox("请输入密码","你知道的")
        $PassWord=StringLower(StringTrimLeft(_MD5($PassWord),2))

        $rContext=_WinHTTP_GetRespond($MyOpen,"http://www.autoitx.com/logging.php?action=login&loginsubmit=yes",1 ,-2,0,0,"formhash=b692c94e&loginfield=username&username="&$Name&"&password="&$PassWord&"&questionid=0&answer=&loginsubmit=%B5%C7%C2%BC",$xzr_sid,"Content-Type: application/x-www-form-urlencoded","_DownLoadByResPodn",$Request)
        $rContext=_WinHTTP_GetRespond($MyOpen,"http://www.autoitx.com/forum-6-1.html",0,2,0,0,"",$xzr_sid& " " &$rContext)
        MsgBox(0,"",StringTrimLeft(BinaryToString($rContext),1000))
        FileWrite(@ScriptDir & "\autoitx.html",$rContext)
        _WinHttpCloseHandle($MyOpen)
       
        Func _DownLoadByResPodn($hRequest)
                $hearder=_WinHttpQueryHeaders($hRequest)
                $Cookies=StringRegExp($hearder,"Set-Cookie: (xzr_auth=.*?;)",3)
                Return $Cookies
        EndFunc
页: [1]
查看完整版本: POST生成COOKIES的问题