找回密码
 加入
搜索
查看: 2745|回复: 1

[网络通信] POST生成COOKIES的问题

[复制链接]
发表于 2010-10-5 01:23:09 | 显示全部楼层 |阅读模式
刚接触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
发表于 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[1]=["$hRequest"]

        $rContext=_WinHTTP_GetRespond($MyOpen,"http://www.autoitx.com/forum-6-1.html")
        $xzr_sid=StringRegExpReplace($rContext[3],"(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[0]),1000))
        FileWrite(@ScriptDir & "\autoitx.html",$rContext[0])
        _WinHttpCloseHandle($MyOpen) 
        
        Func _DownLoadByResPodn($hRequest)
                $hearder=_WinHttpQueryHeaders($hRequest)
                $Cookies=StringRegExp($hearder,"Set-Cookie: (xzr_auth=.*?;)",3)
                Return $Cookies[0]
        EndFunc

评分

参与人数 1金钱 +25 收起 理由
afan + 25

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-9 00:25 , Processed in 0.089027 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表