Witam, mam mały problem, napisałem skrypt który sam ma przepisywać captchę i wysłać postem tekstową captchę, rozwiązywanie captchy i wysyłanie działa bardzo dobrze, ale jest mały problem, pobieram kilka razy stronę z captchą i tokenę więc mi się zmienia sesja captchy i pokazuje mi przez to że niepoprawna captcha bo wysyłam tekst dawnej captchy zamiast aktualną.
Proszę o pomoc:
function pobierzCaptcha() {
$a = curl_init("http://nk.pl/flood_guard_captcha_verification?target=%2Finvite%2F46200582");
curl_setopt($a, CURLOPT_USERAGENT, SETUSERAGENT);
curl_setopt($a, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($a, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($a, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($a, CURLOPT_RETURNTRANSFER, TRUE);
$wynik=curl_exec($a);
//curl_close($a);
preg_match_all('#<input type="hidden" name="auto_form_ticket" value="(.*)">#sU', $wynik, $token); $tokener = $token[1][0];
$ch = curl_init('http://nk.pl/captcha');
$fp = fopen('captcha.png', 'wb'); curl_setopt($ch, CURLOPT_USERAGENT, SETUSERAGENT);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
//curl_close($ch);
require_once 'deathbycaptcha.php';
$client = new DeathByCaptcha_SocketClient('LOGIN_DeathByCaptcha', 'PASSWORD_DeathByCaptcha');
if ($captcha = $client->decode('captcha.png', DeathByCaptcha_Client::DEFAULT_TIMEOUT)) {
echo "CAPTCHA {$captcha['captcha']} solved: {$captcha['text']}\n";
//$curlchanel = curl_init("http://nk.pl/flood_guard_captcha_verification?target=%2F");
$curlchanel = curl_init("http://nk.pl/flood_guard_captcha_verification?target=%2Fmain");
curl_setopt($curlchanel, CURLOPT_USERAGENT, SETUSERAGENT);
curl_setopt($curlchanel, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($curlchanel, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($curlchanel, CURLOPT_HEADER, 0);
curl_setopt($curlchanel, CURLOPT_TIMEOUT, 6);
curl_setopt($curlchanel, CURLOPT_RETURNTRANSFER, 0);
//curl_setopt($curlchanel, CURLOPT_POSTFIELDS, trim("__captcha_a3e3={$captcha['text']}&auto_form_ticket=$tokener"));
curl_setopt
($curlchanel, CURLOPT_POSTFIELDS
, trim("auto_form_ticket=$tokener&__utm_admin=%CE%9DO&__captcha_a3e3={$captcha['text']}&simple_button_submit="));
$wynik=curl_exec($curlchanel);
// curl_close($curlchanel);
}
return $t;
}