php curl авторизация на beeline.ru

Discussion in 'PHP' started by programist11, 26 Sep 2014.

  1. programist11

    programist11 New Member

    Joined:
    23 Feb 2013
    Messages:
    0
    Likes Received:
    1
    Reputations:
    0
    Не получается авторизоваться на beeline.ru

    логин=9637738990
    пароль=76196


    PHP:
    function get_url($url,$cookie='',$post_method=0,$post=''){
    $user_agent='Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.10.289 Version/12.02';//браузер
    if (!$ch=curl_init()) {
        echo 
    'error curl init!';
        exit;
    }
    curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
    curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);
    curl_setopt($chCURLOPT_HEADERtrue);
    curl_setopt($chCURLOPT_POST$post_method);
    curl_setopt($chCURLOPT_USERAGENT$user_agent);
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_TIMEOUT10);
    curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    curl_setopt($chCURLOPT_URL$url);
     
    if (
    $cookie){curl_setopt($chCURLOPT_COOKIE$cookie);}
     
    if (
    $post_method){
    $post=http_build_query($post);
    curl_setopt($chCURLOPT_POSTFIELDS$post);
    }
     
    if (!
    $answer=curl_exec($ch)) {
        echo 
    'error get answer!';
    }
    curl_close($ch);
    return 
    $answer;
    }


    $text=get_url('https://my.beeline.ru/login.html','',1,array(
    'loginFormB2C:loginForm'=>'loginFormB2C:loginForm',
    'loginFormB2C:loginForm:login'=>'9637738990',
    'loginFormB2C:loginForm:password'=>'76196',
    'loginFormB2C:loginForm:passwordVisible'=>'76196',
    'loginFormB2C:loginForm:loginButton:'=>'',
    'javax.faces.ViewState'=>'stateless'
    );
    //отправлю через post на https://my.beeline.ru/login.html 
    //данные для авторизации

    $text =  mb_convert_encoding($text'CP1251''UTF-8');
    echo 
    $text;


    приходит следующий header
    HTTP/1.1 200 OK Server: nginx/1.5.3 Date: Thu, 25 Sep 2014 21:36:37 GMT Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Cache-Control: no-cache, no-store, must-revalidate Pragma: Expires: Thu, 01 Jan 1970 00:00:00 GMT X-Uss-Authorization: 9637738990 X-FRAME-OPTIONS: DENY X-Powered-By: JSF/2.0 X-UA-Compatible: IE=edge Set-Cookie: ui.language.current=ru_RU; expires=Wed, 14-Oct-2082 00:51:03 GMT; path=/; secure Set-Cookie: JSESSIONID=bEOuvtokeL75KJSPRwHFiBgoVqb1Vua48pZf6IMI31qbsBjK_q2H!-247604555; path=/; HttpOnly Set-Cookie: SRV=WebNode33; path=/ Set-Cookie: WGID=mnWG4; path=/

    страница грузится как для неавторизованного пользователя

    через браузер header такой
    Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Charset:windows-1251,utf-8;q=0.7,*;q=0.3
    Accept-Encoding:gzip,deflate,sdch
    Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4
    Cache-Control:max-age=0
    Connection:keep-alive
    Content-Length:256
    Content-Type:application/x-www-form-urlencoded
    Cookie:ui.language.current=ru_RU; SRV=WebNode25; WGID=mnWG2; user_9057146311=9057146311; JSESSIONID=cciuwg0D3gYNV0fBhqLxbJRFVPvjaE43RncJ3A9jOJIo-AO8ezoV!-1481853252; user_9637738990=9637738990; ticket=1a9cb1904c76a7f467eda1004f6cf3941f68a13e; userType=B2C; _ym_visorc_20907697=b; _ym_visorc_20907550=b
    Host:my.beeline.ru
    Origin:https://my.beeline.ru
    Referer:https://my.beeline.ru/login.html
    User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.71 Safari/537.17 YE
     
  2. RazArt

    RazArt New Member

    Joined:
    15 Jun 2009
    Messages:
    12
    Likes Received:
    2
    Reputations:
    0
    а посмотреть все заголовки, которые браузером передаются и проверить со своими? На страничке токенов нет?
     
  3. programist11

    programist11 New Member

    Joined:
    23 Feb 2013
    Messages:
    0
    Likes Received:
    1
    Reputations:
    0
    я их оттуда и взял, токенов нет

    Code:
    POST https://my.beeline.ru/login.html
    302 Found
    Запрос
    POST /login.html HTTP/1.1
    User-Agent: Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.10.289 Version/12.02
    Host: my.beeline.ru
    Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    Accept-Language: ru-RU,ru;q=0.9,en;q=0.8
    Accept-Encoding: gzip, deflate
    Referer: https://my.beeline.ru/login.html
    Cookie: ui.language.current=ru_RU; user_9637738990=9637738990; user_9057146311=9057146311; JSESSIONID=WJuzKacchzS7lHgvTnyRc706aJQNJG53A08Owps6I2SEG5HwfCfd!-1919561932; SRV=WebNode22; WGID=mnWG4; GlobUserRegion=60; GlobUserRegionPath=msk; GlobRegionAncestors=1%7C57%7C60; WT_FPC=id=95.67.129.76-3342256576.30277569:lv=1397664161558:ss=1397663483354; _gat=1; __utma=229051779.977138958.1371242566.1411755122.1411755122.1; __utmb=229051779.1.10.1411755122; __utmc=229051779; __utmz=229051779.1411755122.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _dc_gtm_UA-10061712-37=1; _ga=GA1.2.977138958.1371242566; _gat_UA-10061712-37=1
    Connection: Keep-Alive
    Content-Length: 256
    Content-Type: application/x-www-form-urlencoded
    Имя	Значение
    loginFormB2C:loginForm	loginFormB2C:loginForm
    loginFormB2C:loginForm:login	9637738990
    loginFormB2C:loginForm:password	76196
    loginFormB2C:loginForm:passwordVisible	76196
    loginFormB2C:loginForm:loginButton	
    javax.faces.ViewState	stateless
    
    Ответ
    HTTP/1.1 302 Moved Temporarily
    Server: nginx/1.5.3
    Date: Fri, 26 Sep 2014 18:12:37 GMT
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: 
    Location: http://my.beeline.ru/
    Expires: Thu, 01 Jan 1970 00:00:00 GMT
    X-Uss-Authorization: 9637738990
    X-FRAME-OPTIONS: DENY
    X-Powered-By: JSF/2.0
    X-UA-Compatible: IE=edge
    Set-Cookie: user_9637738990=9637738990; expires=Sun, 26-Oct-2014 18:12:32 GMT; path=/; secure
    Set-Cookie: ticket=e021bfe40f107261c0f8a25c5d7faada6690ba07; path=/; secure
    Set-Cookie: userType=B2C; expires=Fri, 26-Sep-2014 18:18:37 GMT; path=/; secure
    
    <html><head><title>302 Moved Temporarily</title></head>
    <body bgcolor="#FFFFFF">
    <p>This document you requested has moved 
    temporarily.</p>
    <p>It's now at <a href="http://my.beeline.ru/">http://my.beeline.ru/</a>.</p>
    </body></html>
     
  4. M_script

    M_script Members of Antichat

    Joined:
    4 Nov 2004
    Messages:
    2,581
    Likes Received:
    1,317
    Reputations:
    1,557
    'loginFormB2C:loginForm:loginButton:'
     
  5. programist11

    programist11 New Member

    Joined:
    23 Feb 2013
    Messages:
    0
    Likes Received:
    1
    Reputations:
    0
    Спасибо