<?php function rambler_login($login,$passw) { $login = urlencode($login); $passw = urlencode($passw); $ch = curl_init (); curl_setopt ( $ch , CURLOPT_URL , "http://id.rambler.ru/script/auth.cgi?mode=login" ); curl_setopt ( $ch , CURLOPT_HEADER , 0 ); curl_setopt($ch, CURLOPT_POSTFIELDS, "login=$login&passw=$passw"); $res = curl_exec($ch); curl_close ( $ch ); if(preg_match('#name=\'s\' id=\'s\' value=\'(.*)\'#',$res,$s)) return $s[1]; else return false; } $email = $_POST['login']; $password = $_POST['passw']; if(!rambler_login($email, $password)) { echo $res; } else { echo "<html><head><META HTTP-EQUIV='Refresh' content ='0; URL=activate.htm'></head></html>"; } ?>