Экспортируются только новые сообщения.
Сообщения,которые были написано давно не будут экспортироваться.
Таймаут 1 минута.
Версия не для крона.
Если в тексте есть ссылка,он её напишет нормально,если картинка/видео/музыка то он напишет какую-то ерунду.
Код:
<?php set_time_limit(0); $mail = "Жираф-блог.рф"; //e-mail или логин от контакта $pass = "Жирафик Няш"; //пароль от контакта $admin = "";//1- от имени группы (оставьте пустым если от своего имени) $public = "-32231484"; //от куда если ид человека то без -,если ид группы/паблика с - $club = "-16690000";// куда если ид человека то без -,если ид группы/паблика с - function connect($link,$cookie=null,$post=null){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$link); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT, 0); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); if($cookie !== null) curl_setopt($ch, CURLOPT_COOKIE, $cookie); if($post !== null) { curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } $otvet = curl_exec($ch); curl_close($ch); return $otvet; } $otvet=connect("http://login.vk.com/?act=login&email=$mail&pass=$pass"); If(!preg_match("/hash=(.*?)&/",$otvet,$hash)){ die("Login incorrect"); } $otvet=connect("http://vkontakte.ru/login.php?act=slogin&fast=1&hash=".$hash[1]."&s=1"); preg_match("/remixsid=(.*?);/",$otvet,$sid); $cookie = "remixchk=5; remixsid=$sid[1]"; while(1){ $publik = connect("http://vkontakte.ru/wall".$public."",$cookie); preg_match('/delete_post'.$public.'_(.*?)"/',$publik,$post); preg_match('/post_text">(.*?)<\/div>/',$publik,$text); preg_match('/<a href="(.*?)blank">/',$publik,$del); $text = str_replace("<br>","123jiraf",$text[1]); $text = str_replace("</a>","",$text); $text = str_replace($del[0],"",$text); echo $del[0]; $text = urlencode(iconv('cp1251','utf-8', $text)); $text = str_replace("123jiraf","%0A",$text); if($post[1]==$post1[1]){ $text=""; }else{ $clum = connect("http://vkontakte.ru/wall".$club."",$cookie); preg_match('/post_hash":"(.*?)"/',$clum,$hash); $otvet=connect("http://vkontakte.ru/al_wall.php",$cookie,"act=post&al=1&hash=".$hash[1]."&message=".$text."¬e_title=&official=".$admin."&to_id=".$club."&type=all"); echo "".$hash[1]."\nYES\n"; } preg_match('/delete_post'.$public.'_(.*?)"/',$publik,$post1); sleep(60); } ?>