cURL captcha login

Discussion in 'PHP' started by ntesla123, Mar 27, 2011.

  1. #1
    I'm trying to login to a vBulletin forum using a captcha login. I am, however, not able to download the captcha image.

    This is the result I get when I try to get the captcha:

    [​IMG]

    So how do I get the captcha image?

    This is my current login code:

    
    <?php
    $user='username';
    $pass='password';
    $md5Pass = md5($pass);
    $data = "do=login&vb_login_md5password=$md5Pass&vb_login_md5password_utf=$md5Pass&vb_login_username=$user&cookieuser=1";
    
    $ch = curl_init();
    
    curl_setopt ($ch, CURLOPT_URL, "http://www.****.com/login.php?do=login");
    curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    curl_setopt ($ch, CURLOPT_TIMEOUT, '10');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
    curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    
    $store = curl_exec ($ch);
    curl_close($ch);
    echo $store;
    ?> 
    
    Code (markup):
    Maybe the site looks for a cookie and only shows the captcha if it finds the cookie file?
     
    ntesla123, Mar 27, 2011 IP