开发者

Jcaptcha and Curl

开发者 https://www.devze.com 2023-03-05 17:09 出处:网络
I am using curl PHP to get image from Jcaptcha. hidCaptchaID are generated by Jcaptcha. The problem is im keep getting an error saying invalid captcha code, i know the fact the captcha I have enter

I am using curl PHP to get image from Jcaptcha.

hidCaptchaID are generated by Jcaptcha.

The problem is im keep getting an error saying invalid captcha code, i know the fact the captcha I have entered is correct.

I am sending hidCaptchaID, inCaptchaChars and other data using curl

I have checked the header request from firefox firebug and it is actually the same as sending via CURL. Session and cookies are the same as well.

What could be a problem?

Note: My question got nothing to do with captcha bypass/breaker. I enter captcha code manually and then send using curl.

Code:

<?php

$cookiesPath = "c:/wamp/www/cookies";

$a = session_id();
if ($a == '') session_start();

if ($_GET) {

   $form_link = $_GET['newURL'];

    unset($_GET['newURL']);

    $postDataCapcha = http_build_query($_GET);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "\BuiltinObjectToken-VerisignClass3xxxxxxxxxxxxxxxxxxxxxxx.crt");
    curl_setopt($ch, CURLOPT_URL, "https://xxxxx.xxxxx.co.uk/xxxxx/xxxxx/" . $form_link );
    curl_setopt($ch, CURLOPT_POST, 1 );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postDataCapcha);
    curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); 

    curl_setop开发者_运维技巧t($ch, CURLOPT_COOKIE, "JSESSIONID=xxxxxxxxxxxxx:xxxxxxxxx");
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiesPath . "/cookiefile.txt");
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiesPath . "/cookiefile.txt");

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $PagaeCapcha = curl_exec($ch); 

    echo "<hr><br />";
    echo($PagaeCapcha);
    exit();
}


<form action="index.php" method="get">
Number: <br />
<input name="existing_mobile_number" id="existing_mobile_number" type="text">
<br /><br />

Customer Postcode:<br />
 <input name="customer_postcode" id="customer_postcode"  type="text">
<br /><br />
Capcha Code:<br />
<input id="captchauserid" name="inCaptchaChars" type="text">

<input name="hidCaptchaID" value="<?php echo $capcha_id['0']->value; ?>" type="hidden" />
<input name="newURL" type="hidden" value="<?php echo $capchalink; ?>" />

<input value="Go!" type="submit" />
</form>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号