авторизация на mail.ru

Discussion in 'PHP' started by Denis_JJ, 13 Dec 2010.

  1. Denis_JJ

    Denis_JJ New Member

    Joined:
    14 Sep 2010
    Messages:
    1
    Likes Received:
    0
    Reputations:
    0
    Не могу найти ошибку, скрипт не авторизуется, логин и пароль живые


    PHP:
    <?php  

    if (ini_get('display_errors') != 1) { // проверяет значение опции display_errors  
    ini_set('display_errors'1); // включает вывод ошибок вместе с результатом работы скрипта  
    };  
        
         
    if(
    isAuth("tempoa@list.ru","tempoa123") )   
    {  
      
    $ch=curl_init();  
      
    //curl_setopt($ch, CURLOPT_URL, 'http://blogs.mail.ru/cgi-bin/journal/jupdate');  
      
    curl_setopt($chCURLOPT_URL'http://mail.ru/');  
        
      
    curl_setopt($chCURLOPT_RETURNTRANSFER1);    
      
    curl_setopt($chCURLOPT_HEADER1);  
      
    curl_setopt($chCURLOPT_USERAGENT'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3');    
      
    curl_setopt($chCURLOPT_TIMEOUT10);    
      
    curl_setopt($chCURLOPT_REFERER'http://mail.ru/');    
      
    curl_setopt($chCURLOPT_POST1);    
      
    curl_setopt($chCURLOPT_FOLLOWLOCATION0);   
      
    curl_setopt($chCURLOPT_COOKIEJAR$cookie_file_path);  
      
    curl_setopt($chCURLOPT_COOKIEFILE$cookie_file_path);  
        
      
    // "-----------///////////--результат->";  
      
    echo  $result curl_exec($ch);  

    }  
        
         
    function 
    isAuth($email,$password)   
    {  
        global   
    $cookie_file_path;  
        list(
    $maillogin,$domain) = explode("@",$email);  
           
         
    $cookie_file_path realpath(dirname(__FILE__))."/ff/cookie_$maillogin.txt";     //для обычного хостинга  
          //if (!is_writeable($cookie_file_path)) die ("Error not writable cookie to $cookie_file_path");  
         
    $ch=curl_init();  
        
    curl_setopt($chCURLOPT_URL'https://auth.mail.ru/cgi-bin/auth');  
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);    
        
    curl_setopt($chCURLOPT_HEADER1);  
        
    curl_setopt($chCURLOPT_USERAGENT'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3');    
        
    curl_setopt($chCURLOPT_TIMEOUT10);    
        
    curl_setopt($chCURLOPT_REFERER'http://www.mail.ru/'); //Referer: http://www.mail.ru/    
        
    curl_setopt($chCURLOPT_POST1);    
        
    curl_setopt($chCURLOPT_FOLLOWLOCATION0);   

        
    //curl_setopt($ch, CURLOPT_POSTFIELDS,'page=http%3A%2F%2Fblogs.mail.ru&Login='.$maillogin.'&Domain='.$domain.'&Password='.$password);  
        
    curl_setopt($chCURLOPT_POSTFIELDS,'Login='.$maillogin.'&Domain='.$domain.'&Password='.$password);  
          
        
    //curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');  
        
    curl_setopt($chCURLOPT_COOKIEJAR$cookie_file_path);  
        
    curl_setopt($chCURLOPT_COOKIEFILE$cookie_file_path);  
          
        echo 
    $result curl_exec($ch);  
          
          
        if(
    preg_match("#checkcookie#",$result)) {  
            return 
    true;  
        }else return 
    true;  

    }  


    ?>
     
  2. Denis_JJ

    Denis_JJ New Member

    Joined:
    14 Sep 2010
    Messages:
    1
    Likes Received:
    0
    Reputations:
    0
    хеадеры такие

    HTML:
    https://auth.mail.ru/cgi-bin/auth
    
    POST /cgi-bin/auth HTTP/1.1
    Host: auth.mail.ru
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3
    Accept-Encoding: gzip,deflate
    Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Connection: keep-alive
    Referer: http://www.mail.ru/
    Cookie: mrcu=C5954D0510426D8BAAE950248C55; VID=1PAqBd3ByHWq; p=hykGAGLnygAA; b=azoZACCO7gAAFLEPILMlongNFu8O7O4OKrMVlsELLrMdBK8VrlwPls0Pi/oKrdMafeAJ1xIJC5cIGyoQAQAISXQjjQgQeTAb40EI1TsQjXoTEV4L5vhgwpRJLZi7pYlTxjdz1ug2TlTewknDWzilfAsA; searchuid=1354001541292176250; t=obLD1AAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAAAAAAAAACAAAECvgcA; Mpop=1289504521:6544584f6644085b190502190f1d00051c0505034966535c465d070801001e0805071e4d5c55415f5016595e46451a454c:tempoa@list.ru:; waSes=1; posts_subscriptions=tempoa@list.ru,40766065:0; Mpopl=1177643971
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 46
    Login=tempoa&Domain=list.ru&Password=tempoa123
    HTTP/1.1 200 OK
    Server: nginx/0.7.62
    Date: Mon, 13 Dec 2010 19:57:18 GMT
    Content-Type: text/html; charset=windows-1251
    Connection: close
    Content-Encoding: gzip
    Set-Cookie: t=obLD1AAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAABAAAAAAAAAACAAAECvgcA; expires=Sat, 11 Jun 2011 19:57:18 GMT; path=/; domain=.mail.ru
    Set-Cookie: Mpop=1292270238:51644446077b5e07190502190f1d00051c0505034966535c465d070801001e0805071e4d5c55415f5016595e46451a454c:tempoa@list.ru:; expires=Sun, 13 Mar 2011 19:57:18 GMT; path=/; domain=.mail.ru
    Cache-Control: no-cache,no-store,must-revalidate
    Pragma: no-cache
    Expires: Sun, 13 Dec 2009 19:57:18 GMT
    Last-Modified: Mon, 13 Dec 2010 22:57:18 GMT
    Vary: Accept-Encoding
    Content-Length: 383
    X-Host: f217.mail.ru
    X-XSS-Protection: 0