chslive 发表于 2014-11-3 01:12:20

[已解决]POST登陆测试,求大神指导,谢谢!

本帖最后由 chslive 于 2014-11-3 15:54 编辑


#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.12.0
Author:

Script Function:
        Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

;login address:        http://abcs.com.cn/toplogin.asp
;等用户名:abcs密码:123456 邮箱:abcs@abcs.com
;抓包数据
;POST /toplogin.asp?action=login HTTP/1.1
;Accept: text/html, application/xhtml+xml, */*
;X-HttpWatch-RID: 95408-10481
;Referer: http://abcs.com.cn/toplogin.asp?typ=loginout
;Accept-Language: zh-Hans-CN,zh-Hans;q=0.8,en-US;q=0.5,en;q=0.3
;User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
;Content-Type: application/x-www-form-urlencoded
;Accept-Encoding: gzip, deflate
;Host: hibor.com.cn
;Content-Length: 58
;DNT: 1
;Connection: Keep-Alive
;Cache-Control: no-cache
;Cookie: ASP.NET_SessionId=bcu1ilr12mwu10qe5xzucwpx; ASPSESSIONIDSSRDBTRB=JGEAPDPCFHBFBNABMGKPDJIP; Hm_lpvt_d554f0f6d738d9e505c72769d450253d=1414948101; ASPSESSIONIDQQSCATSC=AJJCKGPCBOBEAKLNNNMFHMGG; ASPSESSIONIDQSQCDSTA=MEDALJPCBHCPNFCGCFBPIIFM; ASPSESSIONIDQQTCBTQB=MBOCBPPCLIACFELEPPKIEMCN; ASPSESSIONIDCQSCCTSC=IADLBGADGDMBBJPHNDFOHBFD; ASPSESSIONIDASRDBTSC=AAJIOMADHOCLGPEMHAJBEOGJ; ASPSESSIONIDSSSCCSQA=NMNCCACDGODDDLGOJFBGEHDF; ASPSESSIONIDAAAQCRRA=CPMOAHCDKJGIBLNOFBBHMLMB; ASPSESSIONIDASSABTSC=ACPCCPCDMPLOAFHDDFBANGHB; MBpwd=; MBname=; MBemail=; MBpermission=; CNZZDATA1752123=cnzz_eid%3D291912478-1414853602-%26ntime%3D1414947313; Hm_lvt_d554f0f6d738d9e505c72769d450253d=1414853991,1414916134; c=

;name=huibost&pwd=123456&checkbox=on&tijiao.x=28&tijiao.y=6


;程序
#include<ie.au3>

$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("post","http://abcs.com.cn/toplogin.asp?action=login",false)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Accept-Language", "zh-Hans-CN,zh-Hans;q=0.8,en-US;q=0.5,en;q=0.3")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
$oHTTP.setRequestHeader("Referer","http://abcs.com.cn/toplogin.asp")
$oHTTP.Send("nname=huibost&pwd=123456&checkbox=on&tijiao.x=28&tijiao.y=6")
$sReturn=BinaryToString($oHTTP.responseBody,4)

yuewe 发表于 2014-11-3 09:54:33

本帖最后由 yuewe 于 2014-11-3 09:58 编辑

我也在学习这些,tijiao.x=28&tijiao.y=6好像不要也没关系
Local $user = 'huibost'
Local $pass = '123456'
Local $PostPage = 'http://hibor.com.cn/toplogin.asp?action=login' ;POST地址

$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Option(4) = 13056 ;忽略错误标志
$oHTTP.Option(6) = True ;是否接收重定向地址信息
$oHTTP.SetTimeouts(30000, 30000, 30000, 30000);超时时间设置
;构造POST数据
$postdata = 'name=huibost&pwd=123456'
;尝试POST登录
$oHTTP.Open('POST', $PostPage, False)
$oHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
$oHTTP.Send($postdata)
$Respond = BinaryToString($oHTTP.ResponseBody, 1)
; ConsoleWrite($Respond)
If StringRegExp($Respond, $user&'</span>您好', 0) Then       
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ')登录成功' & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console       
Else
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ')登录失败' & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
EndIf

chslive 发表于 2014-11-3 10:07:19

回复 2# yuewe

啊,你也在学这个啊,我刚接触者玩意儿,觉得挺好玩的;
tijiao.x=28&tijiao.y=6好像不要也没关系是没有关系的,我用了你的代码,好像还是不行,能加下QQ,你Q多少?

chslive 发表于 2014-11-3 15:42:28

已经解决,谢谢关注

user3000 发表于 2014-11-4 17:48:23

回复 4# chslive

楼主,你应该把具体的解决方法贴出来啊~!
发了问题,放了几句话就这样跑了,不厚道的。

ntsanxin 发表于 2014-11-9 08:38:48

接触者玩意儿,觉得挺好玩的

huangke 发表于 2016-2-5 14:36:07

回复 5# user3000


    二楼已经上代码解决了。。。
页: [1]
查看完整版本: [已解决]POST登陆测试,求大神指导,谢谢!