С кодировкой сам разберись, $result = iconv("Windows-1251","UTF-8",$result); у меня что-то не корректно отображается
Действительно, тут немного другая чем на почте...
PHP код:
<?php
@set_time_limit(0);
//-----------------//
$zapros = 'http://yandex.ru/yandsearch?text=antichat&stpar2=%2Fh1%2Ftm4%2Fs2&stpar4=%2Fs2&stpar1=%2Fu0';
//-----------------//
function post($url,$post,$refer)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.4) Gecko/2008102920 AdCentriaIM/1.7 Firefox/3.0.4");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_REFERER, $refer);
curl_setopt($ch, CURLOPT_COOKIEJAR, "./cook");
curl_setopt($ch, CURLOPT_COOKIEFILE, "./cook");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
return $result;
}
if($_POST['captcha'])
{
$result = post('http://captcha.yandex.net/send.xml','key='.$_POST['key'].'&retpath='.$zapros.'%26stpar4%3D%252F+s1&rep='.trim($_POST['captcha']),$zapros);
if(preg_match('#>Вы (.*?) у#i',$result,$end))
{
echo '<script>alert(\'Не правильный код!\')</script>';
echo '<meta http-equiv="Refresh" content="0; url=index.php">';
}
else
{
echo $result;
}
}
else
{
$result = post('http://captcha.yandex.net/',null,'http://yandex.ru/');
preg_match('#y" value="(.*?)"#i',$result,$key);
echo '<img class="captcha-img" name="captcha" src="http://captcha.yandex.net/image?key='.$key[1].'" alt=""><br>
<form name="captcha_form" action="index.php" method="POST">
<input type="text" name="captcha" value="" /><br>
<input type="hidden" name="key" value="'.$key[1].'" />
<input type="submit" value="ok">
</form>';
}
/* geforse.name */
?>
|