
03.04.2010, 01:51
|
|
Постоянный
Регистрация: 26.07.2009
Сообщений: 321
С нами:
8838619
Репутация:
123
|
|
warlok, вот это близко к правде... но думаю, я не заметил еще какую-то проверку( завтра попробую еще поковырять
PHP код:
<?php
#---------------------------------------------------------------------------
function noPost($url)
{
$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_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;
}
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;
}
#---------------------------------------------------------------------------
$first = noPost('http://digg.com/register/','','http://digg.com/register/');
preg_match("#/captcha/(.*?).jpg#",$first,$capcha);
//адрес картинки
$Capch = 'http://digg.com' . $capcha['0'];
//получаем картинку
$img = noPost($Capch,'','');
//сохраняем в файл
file_put_contents('captcha.jpg',$img );
#---------------------------------------------------------------------------
if(isset($_POST['captcha']))
{
echo post('http://digg.com/register/',$_POST['captcha'] ,'http://digg.com/register/');
}
else
{
echo '<img src="captcha.jpg"> <br />
<form id="form1" name="form1" method="post" action="">
<label>
<input type="text" name="captcha[input]" id="captcha[input]" />
</label>
<input type="hidden" id="captcha[id]" name="captcha[id]" value="'.$capcha['1'].'" />
<label>
<input type="submit" name="button" id="button" value="Отправить" />
</label>
</form>';
}
?>
Tesson, пробей в гугле "javascript создание окон"
|
|
|