function login($login,$pass) { $ch = curl_init('https://passport.yandex.ru/passport?mode=auth'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3'); curl_setopt($ch, CURLOPT_REFERER, 'https://passport.yandex.ru/passport?mode=auth'); curl_setopt($ch, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT'].'cook.txt'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "login=$login&passwd=$pass"); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $res = curl_exec($ch); if(preg_match('#https:\/\/passport\.yandex.ru\/passport\?mode=logout#',$res)) return true; }