1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Does Anyone Have An Example Of A PHP Script That Has Integrated The Decaptcher API?

Discussion in 'PHP & Perl' started by gimme4free, Mar 10, 2010.

  1. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,879
    Likes Received:
    1,931
    Does Anyone Have An Example Of A PHP Script That Has Integrated The Decaptcher API?
     
  2. Zooker

    Zooker Newbie

    Joined:
    Jan 13, 2010
    Messages:
    17
    Likes Received:
    1
    Actually, possibly soon. I was actually just looking into this service to see if i could find out the speed of the results received back.

    I do plan on using php to access it so it is possible in the next day i will toss together a quick example just to test how they handle it. if i do, i'll toss it up here for everyone to see
     
  3. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,879
    Likes Received:
    1,931
    I am pretty sure that I read that the speed is 10 seconds and can be up to 30 seconds. I found this example on this forum but I have not tested it yet. I updated the poster URL to the latest one and will be trying it out soon:

    PHP:
    <?php
    Function Curlypost ($address$postdata)
    {
        
    $reffer $address;
        
    $agent "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
        
    $cookie_file_path "cookie.txt"
        
    $ch curl_init();    
        
    curl_setopt($chCURLOPT_URL$address); 
        
    curl_setopt($chCURLOPT_USERAGENT$agent);
        
    curl_setopt($chCURLOPT_POST1);  
        
    curl_setopt($chCURLOPT_POSTFIELDS,$postdata); 
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1); 
        
    curl_setopt($chCURLOPT_FOLLOWLOCATION1); 
        
    curl_setopt($chCURLOPT_REFERER$reffer);
        
    curl_setopt($chCURLOPT_COOKIEFILE$cookie_file_path); 
        
    curl_setopt($chCURLOPT_COOKIEJAR$cookie_file_path); 
        
    curl_setopt($chCURLOPT_CONNECTTIMEOUT20);
        
    curl_setopt($chCURLOPT_TIMEOUT50);
        
    curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse); 
        
    curl_setopt($chCURLOPT_SSL_VERIFYHOST0); 
        
    $result curl_exec($ch);  
        
    curl_close($ch);  
        return 
    $result;
    }
      
    Function 
    RecogniseCaptcha ($username$password$filename)
    {

      
    $postData = array();
      
    $postData'function' ] = "picture2";
      
    $postData'username' ] = "$username";
      
    $postData'password' ] = "$password";
      
    $postData'pict_to' ] = "0";
      
    $postData'pict_type' ] = "0";
      
    $postData'pict' ] = '@'.realpath("$filename");
      
    $postData'submit' ] = "Send";
      
      
    $data curlypost ("http://poster.decaptcher.com/"$postData);
      
    $pieces explode ("|"$data);
      return 
    $pieces [5];
    }

    echo 
    RecogniseCaptcha ("username""password""pic.jpg");
    ?>
     
  4. GetThatMoney

    GetThatMoney Registered Member

    Joined:
    Aug 20, 2007
    Messages:
    55
    Likes Received:
    7
    Code:
    $post = array("function" => "picture2",
    "username" => D_USER,
    "password" => D_PASS,
    "pict" => "@captcha_img.png",
    "pict_to" => 0,
    "pict_type" => 82
    );
    
    $captchaurl = "http://poster.decaptcher.com/";
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL,$captchaurl); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postit);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $captchastring = curl_exec ($ch); 
    unset($ch); 
    			
    $d = explode('|', $captchastring);
    $dresult = $d[0];
    $dmajor = $d[1];
    $dminor = $d[2];
    $dtype = $d[3];
    $dtimeout = $d[4];
    $captcha = $d[5]; //CAPTCHA STRING
     
    • Thanks Thanks x 1