|
Участник форума
Регистрация: 31.08.2006
Сообщений: 149
С нами:
10365076
Репутация:
155
|
|
Короче ТС выложил скрипт даже не смотрев на него)))
Исправил ошибки. Добавил отсутствующие функции, привел код в порядок и в рабочий вид.
Code:
PHP код:
<?
//setting//
$sikoka=30; // coli4estvo accov
$anticapkey='6b3b46871'; // key v anticaptcha
$dir="C:\WebServers\home\localhost\www\\"; // localniy pyt'
// functions //
function get_random_string($length) // количество символов
{
$ret = "";
for ( $i=0; $i<=$length; $i++)
{
if ( mt_rand(1,2) == 1 )
$char_code = mt_rand(48, 57); // цифра...
else
$char_code = mt_rand(65, 90); // .. или буква
$ret .= chr($char_code);
}
return $ret;
}
function recognize($filename, $apikey, $is_verbose = true, $rtimeout = 5, $mtimeout = 120, $is_phrase = 0, $is_regsense = 0, $is_numeric = 0, $min_len = 0, $max_len = 0)
{
if (!file_exists($filename))
{
if ($is_verbose) echo "file $filename not found\n";
return false;
}
$postdata = array(
'method' => 'post',
'key' => $apikey,
'file' => '@'.$filename, //полный путь к файлу
'phrase' => $is_phrase,
'regsense' => $is_regsense,
'numeric' => $is_numeric,
'min_len' => $min_len,
'max_len' => $max_len,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://www.anti-captcha.com/in.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
$result = curl_exec($ch);
if (curl_errno($ch))
{
if ($is_verbose) echo "";
return false;
}
curl_close($ch);
if (strpos($result, "ERROR")!==false)
{
if ($is_verbose) echo "";
return false;
}
else
{
$ex = explode("|", $result);
$captcha_id = $ex[1];
if ($is_verbose) echo "";
$waittime = 0;
if ($is_verbose) echo "";
sleep($rtimeout);
while(true)
{
$result = file_get_contents('http://anti-captcha.com/res.php?key='.$apikey.'&action=get&id='.$captcha_id);
if (strpos($result, 'ERROR')!==false)
{
if ($is_verbose) echo "";
return false;
}
if ($result=="CAPCHA_NOT_READY")
{
if ($is_verbose) echo "";
$waittime += $rtimeout;
if ($waittime>$mtimeout)
{
if ($is_verbose) echo "";
break;
}
if ($is_verbose) echo "";
sleep($rtimeout);
}
else
{
$ex = explode('|', $result);
if (trim($ex[0])=='OK') return trim($ex[1]);
}
}
return false;
}
}
//Work//
for($i=0;$i<$sikoka;$i++)
{
$mail=get_random_string(15);
$fname=get_random_string(5);
$lname=get_random_string(5);
$pass=get_random_string(8);
$hinta=get_random_string(7);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://passport.yandex.ru/passport?mode=register');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'step=one&filled=yes&iname='.$lname.'&fname='.$fname.'&login='.$mail.'&done=%C4%E0%EB%FC%F8%E5%A0%26%238594%3B'); curl_setopt($ch, CURLOPT_HEADER,1);
$result = curl_exec($ch);
preg_match('/Set-Cookie: (.*) path=/i',$result,$match);
$cookie=$match[1];
preg_match('/<img src=\"(.*)\" name=\"captcha\" border=\"0\"/i', $result,$match);
$urlcap=$match[1];
preg_match('/<input type=\"hidden\" name=\"idkey\" value=\"(.*)\">/i',$result,$match);
$idkey=$match[1];
print "Попытка #".$i."<br>Ссылка каптчи: ".$urlcap."<br>Id каптчи: ".$idkey."<br>\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$urlcap);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
$result = curl_exec($ch);
$fp=fopen('cap.gif','w');
fwrite($fp,$result);
fclose($fp);
$text=recognize($dir."cap.gif",$anticapkey);
print("Разгадали каптчу: ".$text."<br>");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'http://passport.yandex.ru/passport?mode=regone');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,60);
curl_setopt($ch, CURLOPT_POST,1);
$post='idkey='.$idkey.'&step=two&filled=yes&iname='.$lname.'&fname='.$fname.'&login='.$mail.'&passwd='.$pass.'&passwd2='.$pass.'&hintq=2&udhintq=&hinta='.$hinta.'&hintasave='.$hinta.'&questnum=2&hintqsave=&email=&phonenumber=&code='.$text.'&agreed=yes&done=%C7%E0%F0%E5%E3%E8%F1%F2%F0%E8%F0%EE%E2%E0%F2%FC';
curl_setopt($ch, CURLOPT_COOKIE,$cookie);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
$result = curl_exec($ch);
if(preg_match("/Set-Cookie: yandex_login/i",$result))
{
print "<strong>Зарегили мыло</strong>: ".$mail."@ya.ru:".$pass."<br><br>";
}else{
print "Ошибка<br>"; }
}
?>
Запись в файл делайте сами, не маленькие.
|