[Perl] Как передать ключ russian?

Discussion in 'PHP' started by _Spamer_, 25 Jan 2011.

  1. _Spamer_

    _Spamer_ Elder - Старейшина

    Joined:
    3 Feb 2009
    Messages:
    83
    Likes Received:
    140
    Reputations:
    16
    Есть код

    Code:
    # send captcha
    sub anti_captcha {
         my $file = $_[0];
         my $ua = new LWP::UserAgent;
         my $data = undef;
         TRY:
          my $res = $ua->post(
                 'http://'.$AntiCaptcha_HOST.'/in.php',
                 Content_Type => 'form-data',
                 Content  => [
                     file => [
                         './tmp/'.$file,
                         $file,
                         "Content-Type" => "application/octet-stream"
                     ],
                     method => "post",
                     key    => $AntiCaptcha_KEY,
                 ])->content;
         if($res =~ /OK\|(\d+)/) {
             my $akey = $1;
             do {
                 print ' .  captcha not ready..'."\n";
                 $data = $ua->get('http://'.$AntiCaptcha_HOST.'/res.php?key='.$AntiCaptcha_KEY.'&action=get&id='.$akey)->content;
                 sleep 5;
             }
             while($data =~ /CAPCHA_NOT_READY/);
             $data =~ /OK\|(.*)/;
             $data = $1;
         }
         elsif($res =~ /ERROR_KEY_DOES_NOT_EXIST/) {
             print ' .  a-captcha: invalid AC key';
             
         }
         elsif($res =~ /ERROR_NO_SLOT_AVAILABLE/) {
             print ' .  a-captcha: no slot avaible..'."\n";
             sleep 2;
             goto TRY;
         }
         elsif($res =~ /ERROR_ZERO_CAPTCHA_FILESIZE/) {
             print ' .  a-captcha: captcha upload error'."\n";
             sleep 1;
             goto TRY;
         }
         elsif($res =~ /\n\n(.*)/s) {
             print ' -  a-captcha: error: <'.$1.'>'."\n";
         }
         else {
             print ' -  a-captcha: '.$AntiCaptcha_HOST.' is not avaible'."\n";
             
         }
         print ' +  a-captcha: recognized '.$data."\n";
         unlink './tmp/'.$file;
         chomp $data;
         return $data;
    Нужно добавить ключ is_russian = 2
    Заранее спс
     
  2. dpe_x

    dpe_x Elder - Старейшина

    Joined:
    8 Sep 2010
    Messages:
    155
    Likes Received:
    35
    Reputations:
    14
    пользуйся этим модулем и не парься..
    в настройках просто добавишь параметр..
    http://kaimi.ru/2009/05/anticaptcha-perl/
     
  3. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,194
    Reputations:
    252
    PHP:
    $data $ua->get('http://'.$AntiCaptcha_HOST.'/res.php?is_russian=2&key='.$AntiCaptcha_KEY.'&action=get&id='.$akey)->content;