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

[IE类操作] 如何保存当前页面的验证码图片到本地

[复制链接]
发表于 2015-5-17 00:33:08 | 显示全部楼层 |阅读模式
本帖最后由 xymc 于 2015-5-17 03:40 编辑

http://www.lingpao8.com/
当前页面上的验证码图片如何保存到本地,然后我通过QQ超人打码来识别自动输入

麻烦大家帮我看看

以下是调用QQ超人打码的
现在主要是这个图片路径找不到
Global $user = "123456" ;QQ超人打码账号
Global $pass = "123456" ;QQ超人打码密码
Global $softId = "0" ;软件ID,缺省为0
Global $path = @ScriptDir & "\dc.dll" ;插件路径
Global $imgpath = @ScriptDir & "\1688.png" ;图片路径
Global $dll = DllOpen($path)

;查询剩余点数
$result = DllCall($dll,"str","GetUserInfo","str",$user,"str",$pass)  
If IsArray($result) Then
        If $result[0]>0 Then
                ConsoleWrite("剩余点数:" & $result[0] & @CRLF);查询成功
        Else
        ConsoleWrite("错误信息:" & $result[0] & @CRLF);错误信息
        Exit
        EndIf
EndIf

;调用RecYZM_A,根据验证码路径识别
$result = DllCall($dll,"str","RecYZM_A","str",$imgpath,"str",$user,"str",$pass,"str",$softId)
If IsArray($result) Then
        $aArray = StringSplit($result[0],"|")
        MsgBox(64,"答案","获得的答案为:"&$aArray[1])
        ConsoleWrite("验证码结果:" & $aArray[1] & "  打码工人:" & $aArray[3] & @CRLF)
EndIf

;ReportError报告错误

$worker = "6980F20873A9430582C819FB54D0E480" ;打码工人编号
$result = DllCall($dll,"none","ReportError","str",$user,"str",$worker)

为什么我用以下代码保存的验证码图片和网页打开的验证码不一样,关键还是如何把当前打开页面上的这个验证码图片保存到本地
我试过手动右键另存为是可以的,但AU3怎么能保存到呢?
$url="http://www.lingpao8.com/site/captcha/v/555769f74e00e.html"
$xmlhttp=ObjCreate("msxml2.xmlhttp")
If IsObj($xmlhttp) Then
        $xmlhttp.open("GET",$url,True)
        $xmlhttp.send
        While $xmlhttp.readystate<>4
                Sleep(100)
        WEnd
        If $xmlhttp.status=200 Then
                $tmp=StringRegExp($xmlhttp.getresponseheader("Content-Type"),"(?is)image\/(.+)",3)
                If IsArray($tmp) Then
                        $file=FileOpen(@ScriptDir&"\temp."&$tmp[0],2+8+16)
                        FileWrite($file,$xmlhttp.responsebody)
                        FileClose($file)
                        ShellExecute(@ScriptDir&"\temp."&$tmp[0])
                EndIf
        EndIf
EndIf
发表于 2015-6-3 21:16:12 | 显示全部楼层
验证图片需要注意保持Cookies一致的,每次访问是不一样的。
你给的这个网页是动态页生成的静态页,刷新没有变化。但是Cookies已经不一样了。
一般是下载验证码图片,记住Cookies,在识别完后提交的时候要带Cookies一起提交。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-27 13:40 , Processed in 0.073765 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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