找回密码
 加入
搜索
查看: 2251|回复: 2

[系统综合] 求天涯post登录用户发帖

[复制链接]
发表于 2013-11-3 01:06:31 | 显示全部楼层 |阅读模式
已经实现大部分代码了,现在问题是无法登录用户。
我用xmlhttp组建可以共享IE的cookies,所以在网页上登录后程序就无需二次登录。
关键是,用了xmlhttp就无法获取到验证码,所以改用winhttp.winhttprequest.5.1组建,因此cookies就无法共享了。
求大神给一个解决的办法,谢谢!
$hForm=guicreate("输入验证码",150,150)
guisetbkcolor(0x000000)
guictrlcreatelabel("验证码:",0,0,0,0)
$hCode=guictrlcreateinput("",10,120,80,20)
$hOK=guictrlcreatebutton("确认",90,120,50,20)
$hPic=guictrlcreatepic("",5,5,140,105)

const $chkpic=@tempdir&"\~"&random(10000,99999,1)&".gif"
$url="http://imgcode.tianya.cn/services/ImageCodeService"
$oIE=objcreate("winhttp.winhttprequest.5.1")
$oIE.open("GET",$url,false)
$oIE.setRequestHeader("Referer",$url)
$oIE.send()
$HTMLSource=$oIE.ResponseBody
$oH=ObjCreate("Adodb.Stream")
$oH.Type = 1
$oH.Mode = 3
$oH.Open
$oH.write($htmlsource)
$oH.SaveToFile($chkpic)
$oH.Close()
guictrlsetimage($hPic,$chkpic)
filedelete($chkpic)
guisetstate()

while 1
switch guigetmsg()
case -3
exit

case $hOK
$vCode=guictrlread($hCode)
if $vCode then
$url="http://bbs.tianya.cn/api?method=bbs.ice.compose"
$data="params.item=water&parmas.bScore+=true¶ms.subItem="& _
"¶ms.vCode="&$vCode& _
"¶ms.title=hello123"& _
"¶ms.content=test_text_text_content"

$oIE.open("POST",$url,False)
$oIE.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oIE.setRequestHeader("Referer",$url)
$oIE.Send($data)
$htm=binarytostring($oIE.ResponseBody,4)
msgbox(0,'',$htm)
else
msgbox(48,"提示","你还没输入验证码呢!")
endif
endswitch
wend
 楼主| 发表于 2013-11-8 00:11:11 | 显示全部楼层
求大神,登陆能实现不。。。
发表于 2013-11-9 23:17:00 | 显示全部楼层
不知道呢
同问
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-8 06:33 , Processed in 0.073199 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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