
01.01.2010, 17:20
|
|
Участник форума
Регистрация: 05.06.2009
Сообщений: 225
Провел на форуме: 2793173
Репутация:
297
|
|
PHP код:
<?php
set_time_limit(0);
###################################
$email = ''; // E-mail
$pass = ''; // Пароль
$log = '1'; // 1 - Если нужно писать log-файл
###################################
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;
}
$result = post('http://vkontakte.ru/',null,'http://vkontakte.ru/');
/* Авторизовываемся без кук */
if (preg_match('#l">E(.*?)<#i',$result,$avtoriz))
{
$result = post('http://login.vk.com/','act=login&success_url=&fail_url=&try_to_login=1&to=&vk=&email='.$email.'&pass='.$pass,'http://vkontakte.ru/login.php?m=1&email='.$email);
if ($log == "1")
{
$fh = fopen("log.txt", "a+");
$success - fwrite($fh, "[$email]Авторизация - [".date("H:i")."]\r\n");
fclose($fh);
}
}
else
{
if ($log == "1")
{
$fh = fopen("log.txt", "a+");
$success - fwrite($fh, "[$email]Работа через cookie [".date("H:i")."]\r\n");
fclose($fh);
}
}
?>
|
|
|