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

Decaptcha Triple Captcha Issue

Discussion in 'PHP & Perl' started by haydenm92, Jan 12, 2010.

  1. haydenm92

    haydenm92 Junior Member

    Joined:
    Apr 24, 2008
    Messages:
    141
    Likes Received:
    40
    Occupation:
    Student/Blackhatting
    Location:
    Idaho
    Home Page:
    I'm trying to use decaptcha with iMacro to auto solve and fill captchas. I have everything up to the point of getting the captcha. When iMacro loads the main.php file then displays my solved captcha, it shows the captcha 3 times. So then my iMacro proceeds to copy that solved triple displayed captcha, but I only want/need it to copy that one of the three identical captchas.

    Here is decaptcha's main.php file code:

    Code:
    <?php
    	require( 'ccproto_client.php' );
    
    	// your connect information
    	define( 'HOST',		"72.233.64.162"	);	// YOUR HOST
    	define( 'PORT',		7462		);	// YOUR PORT
    	define( 'USERNAME',	"myusername"	);	// YOUR LOGIN
    	define( 'PASSWORD',	"mypassword");	// YOUR PASSWORD
    
    	define( 'PIC_FILE_NAME',	"pic.jpg"	);
        
    	$ccp = new ccproto();
    	$ccp->init();
    
    	print( "" );
    	if( $ccp->login( HOST, PORT, USERNAME, PASSWORD ) < 0 ) {
    		print( " FAILED\n" );
    		return;
    	} else {
    		print( "" );
    	}
    
    	$system_load = 0;
    	if( $ccp->system_load( $system_load ) != ccERR_OK ) {
    		print( "" );
    		return;
    	}
    	print( "" );
    
    	$balance = 0;
    	if( $ccp->balance( $balance ) != ccERR_OK ) {
    		print( "" );
    		return;
    	}
    	print( "" );
    
    	$major_id	= 0;
    	$minor_id	= 0;
    	for( $i = 0; $i < 3; $i++ ) {
    		$pict = file_get_contents( PIC_FILE_NAME );
    		$text = '';
    		print( "" );
    
    		$pict_to	= ptoDEFAULT;
    		$pict_type	= ptUNSPECIFIED;
    		
    		$res = $ccp->picture2( $pict, $pict_to, $pict_type, $text, $major_id, $minor_id );
    		switch( $res ) {
    			// most common return codes
    			case ccERR_OK:
    				print( $text );
    				break;
    			case ccERR_BALANCE:
    				print( "not enough funds to process a picture, balance is depleted" );
    				break;
    			case ccERR_TIMEOUT:
    				print( "picture has been timed out on server (payment not taken)" );
    				break;
    			case ccERR_OVERLOAD:
    				print( "temporarily server-side error" );
    				print( " server's overloaded, wait a little before sending a new picture" );
    				break;
    		
    			// local errors
    			case ccERR_STATUS:
    				print( "local error." );
    				print( " either ccproto_init() or ccproto_login() has not been successfully called prior to ccproto_picture()" );
    				print( " need ccproto_init() and ccproto_login() to be called" );
    				break;
    		
    			// network errors
    			case ccERR_NET_ERROR:
    				print( "network troubles, better to call ccproto_login() again" );
    				break;
    		
    			// server-side errors
    			case ccERR_TEXT_SIZE:
    				print( "size of the text returned is too big" );
    				break;
    			case ccERR_GENERAL:
    				print( "server-side error, better to call ccproto_login() again" );
    				break;
    			case ccERR_UNKNOWN:
    				print( " unknown error, better to call ccproto_login() again" );
    				break;
    		
    			default:
    				// any other known errors?
    				break;
    		}
    		print ( "\n" );
    
    		// process a picture and if it is badly recognized 
    		// call picture_bad2() to name it as error. 
    		// pictures named bad are not charged
    
    		//$ccp->picture_bad2( $major_id, $minor_id );
    	}
    
    	$balance = 0;
    	if( $ccp->balance( $balance ) != ccERR_OK ) {
    		print( "balance() FAILED\n" );
    		return;
    	}
    	print( "" );
    
    	$ccp->close();
    
    	// also you can mark picture as bad after session is closed, but you need to be logged in again
    	$ccp->init();
    	print( "" );
    	if( $ccp->login( HOST, PORT, USERNAME, PASSWORD ) < 0 ) {
    		print( "" );
    		return;
    	} else {
    		print( "" );
    	}
    	print( "" );
    	$ccp->picture_bad2( $major_id, $minor_id );
    	$ccp->close();
    
    
    ?>
    If anyone has any ideas how to fix it from displaying the captcha three times rather than one, I would greatly appreciate it.

    Thanks,
    Hayden

    P.S.- Here is a pic of the captcha being displayed three times incase it gives any further insight:

    http://img191.imageshack.us/img191/5228/81697709.jpg
     
  2. crilla

    crilla Newbie

    Joined:
    Jul 6, 2009
    Messages:
    1
    Likes Received:
    0
    cause there is a loop
    for( $i = 0; $i < 3; $i++ ) {

    lern php or get someone to make this script ready
    i would suggest to request the solved captchas 3-4 times, then check the most common response
     
  3. haydenm92

    haydenm92 Junior Member

    Joined:
    Apr 24, 2008
    Messages:
    141
    Likes Received:
    40
    Occupation:
    Student/Blackhatting
    Location:
    Idaho
    Home Page:
    Thanks, I just found the answer somewhere else and was getting ready to repost it here in case anyone was following the thread but you beat me to it.

    Thanks for the help, I'm a complete beginner when it comes to php, so I would have never gotten that.