如何使用处理验证码的购买服务处理Google验证码图像

时间:2014-01-24 09:57:47

标签: asp.net

我在使用第三方服务的Google验证码图片句柄中遇到问题。

但是当我将Google验证码图片网址发送到服务API时。它回应我下一张图片验证码。

Google验证码网址会在每次加载时显示下一张图片。

1 个答案:

答案 0 :(得分:0)

在这个逻辑中,我发布了谷歌验证码图片。捕获验证码图像并保存。

protected function captchaLoadComplete():void
            {
                                    var fileStream:FileStream = new FileStream();   


enter code here


                    // Capture captcha image
                    var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(WBCaptcha);

                    // Encode captcha image into JPEG format
                    var oJpg:JPEGEncoder = new JPEGEncoder();               
                    var data:ByteArray = oJpg.encode(imageBitmapData);

                    // *** Here load the captcha image in MAC os ***
                    if((Capabilities.os.indexOf("Mac") >= 0))
                    {
                        //*** Save the downloaded file without generate browser popup ***
                        fileStream.open(new File(File.applicationStorageDirectory.nativePath+"/temp.jpg"),FileMode.WRITE);  

                        fileStream.writeBytes(data, 0, data.length);

                    }else if((Capabilities.os.indexOf("Windows") >= 0))
                    {                   
                        // Save the Capture image without generate browser popup 
                        fileStream.open(new File(File.applicationStorageDirectory.nativePath+"\\temp.jpg"),FileMode.WRITE);             
                        fileStream.writeBytes(data, 0, data.length);

                        // load Capture image in window os
                        imgCaptcha.source = File.applicationStorageDirectory.nativePath +"\\"+ "temp.jpg";

                    }   
                    timerforLoadPage = new Timer(5000, 0);
                    timerforLoadPage.addEventListener(TimerEvent.TIMER, imageLoadComplete);
                    timerforLoadPage.start();   // Start timer

                            }