<?php
function token($content){
preg_match('/<input type="hidden" id="_token" name="_token" value="(.*?)" \/>/', $content, $w);
return $w[1];
}
$hand = curl_init();
//POBIERANIE TOKENA
curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/pl/referrer/kavillock');
curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
curl_setopt($hand, CURLOPT_COOKIESESSION, true);
curl_setopt($hand, CURLOPT_COOKIEFILE, dirname(__FILE__)."/tmp/cookiefile.txt");
curl_setopt($hand, CURLOPT_COOKIEJAR, dirname(__FILE__)."/tmp/cookiefile.txt");
$p=curl_exec($hand);
$token = token($p);
if ($_POST['submit'] != 'submit'){
//WPROWADZENIE DANYCH DO REJESTRACJI
curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/pl/referrer/kavillock');
curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1)");
curl_setopt($hand, CURLOPT_POST, 1);
curl_setopt($hand, CURLOPT_REFERER, 'http://www.erepublik.com/pl/referrer/kavillock');
$ok = urlencode('Zostañ obywatelem');
curl_setopt($hand, CURLOPT_POSTFIELDS, array(
'_token' => $token,
'citizen_name' => 'kavulilo',
'citizen_password' => 'adsakura',
'citizen_password2' => 'adsakura',
'country_list' => 35,
'region_list' => 426,
'region_selected_id' => '',
'nationality_list' => 192,
'citizen_email' => 'a978026@owlpic.com',
'birth_date[]' => Array
(
0 => 21,
1 => 6,
2 => 1992
),
'gender' => 'M',
'commit' => $ok,
'agree' => 1,
'newsletter' => 1
));
$p=curl_exec($hand);
echo '<textarea rows="10" cols="150">'.$p.'</textarea><br>';
//WYSWIETLANIE FORMULARZA
curl_setopt($hand, CURLOPT_URL, 'http://api.recaptcha.net/noscript?k=6LfEGgIAAAAAABSqQ0rzMd3t-rOU_XrZlC2C9WG2');
curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
$p=curl_exec($hand);
preg_match('/<input type="hidden" name="recaptcha_challenge_field" id="recaptcha_challenge_field" value="(.*?)" \/>/',$p,$dana);
$obraz = 'http://api.recaptcha.net/image?c='.$dana[1];
echo '<img src="'.$obraz.'" />';
echo'<form method="POST"><input name="id"><input type="hidden" value="'.$dana[1].'" name="dana"><input type="submit" name="submit" value="submit"></form>';
}else{
//WYSY£ANIE DANYCH DO RECAPTCHA
$sub = urlencode('I\'m a Human');
curl_setopt($hand, CURLOPT_URL, 'http://api.recaptcha.net/noscript?k=6LfEGgIAAAAAABSqQ0rzMd3t-rOU_XrZlC2C9WG2');
curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
curl_setopt($hand, CURLOPT_POST, 1);
curl_setopt($hand, CURLOPT_POSTFIELDS, array(
'recaptcha_challenge_field' => $_POST['dana'],
'recaptcha_response_field' => $_POST['id'],
'submit' => $sub
));
$p=curl_exec($hand);
preg_match('/<textarea rows="3" cols="40">(.*?)<\/textarea>/s',$p,$kod);
//WYSY£ANIE DANYCH CAPTCHA
curl_setopt($hand, CURLOPT_URL, 'http://www.erepublik.com/pl/register_captcha');
curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($hand, CURLPROXY_HTTP, '122.224.33.10:80');
curl_setopt($hand, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1)");
curl_setopt($hand, CURLOPT_POST, 1);
curl_setopt($hand, CURLOPT_HEADER, true);
curl_setopt($hand, CURLOPT_REFERER, 'http://www.erepublik.com/pl/referrer/kavillock');
curl_setopt($hand, CURLOPT_POSTFIELDS, array(
'_token' => $token,
'recaptcha_challenge_field' => $kod[1],
'recaptcha_response_field' => 'manual_challenge',
'commit' => $ok
));
$p=curl_exec($hand);
echo '<textarea rows="10" cols="150">'.$p.'</textarea><br>';
curl_close($hand);
}
?>