Smort.com регистрация на PHP

Discussion in 'PHP' started by Student :), 8 Dec 2012.

  1. Student :)

    Student :) Elder - Старейшина

    Joined:
    9 Feb 2007
    Messages:
    278
    Likes Received:
    18
    Reputations:
    -15
    Smort.com регистрация на PHP
    не получ сделать пишет неверная каптча (
    хотя сесия верная передаёться каптчи
    вот код

    PHP:
    function Curl($url$refr$cookie$head 0$reqwith 0$pos 0$postdata ''

        
    $ch curl_init($url); 
        if(
    $head
        { 
        
    curl_setopt($chCURLOPT_HEADER1); 
        } 

        
    curl_setopt($chCURLOPT_USERAGENT'Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0'); 
        
    curl_setopt($chCURLOPT_REFERER$refr); 
        
    curl_setopt($chCURLOPT_COOKIE$cookie); 
       
    curl_setopt($chCURLOPT_RETURNTRANSFER1); 
        if(
    $reqwith
            
    curl_setopt($chCURLOPT_HTTPHEADER, array('X-Requested-With' => 'XMLHttpRequest')); 
        if (
    $pos
        { 
            
    curl_setopt($chCURLOPT_POST1); 
            
    curl_setopt($chCURLOPT_POSTFIELDS$postdata); 
        } 
        
    $result2 curl_exec($ch) or die(curl_error($ch)); 
        
    curl_close($ch); 
        return 
    $result2


    $mails='1234gmail.com'
    $Page Curl('http://smotri.com/''http://smotri.com'null1null,null,null);  
    preg_match_all('#Set-Cookie: ([^;]+);#'$Page$Cookies); 
    $Cookies implode(';'$Cookies['1']); 
    $out=Curl('http://smotri.com/profile/ajax/check/submit/field/-/sign_up_email/signup_fast/''http://smotri.com'$Cookies111,'value='.$mails.''); 
    preg_match"/\'sign_up_email\'\, (.*)\)\;/"$out$e1); 
    //проверка мыла 
    if($e1[1]=='0'){echo 'error no mail ok';exit;} 
    echo 
    'mail -- ok';  
    /// polucheniya logina i pass 
    Curl('http://smotri.com/registration/submit/''http://smotri.com'$Cookies1null1,'signup_fast-hint53=1&sign_up_email='.$mails.'&back_url=&sing_up_fast=1');  
    // captcha 
    $captcha Curl('http://smotri.com/profile/captcha/''http://smotri.com/registration/submit/'$Cookies1null,null,null); 
    $file fopen('captcha.jpg''w'); 
    fwrite($file$captcha); 
    fclose($file); 

    //// registration 
    $Nick =vasya
    $Pass 'qazwsx123'
    echo 
    $Nick


    if(
    $_POST['s']){ 
    $out3=Curl('http://smotri.com/registration/submit/''http://smotri.com/registration/submit/'$Cookies1null1,'signup-hint53=1&sign_up_email='.$mails.'&sign_up_login='.$Nick.'&sign_up_password='.$Pass.'&sign_up_nick=vasya&signup_key='.$_POST['captha'].'&back_url=&sign_up_agreement=1&x='.rand(1,30).'&y='.rand(1,30).'&sing_up_submit=1');  
    echo 
    $out3
    exit; 
    }  
     
  2. Student :)

    Student :) Elder - Старейшина

    Joined:
    9 Feb 2007
    Messages:
    278
    Likes Received:
    18
    Reputations:
    -15
    неверно сесия каптчи передаться? ((
     
  3. kolia

    kolia Elder - Старейшина

    Joined:
    11 Oct 2012
    Messages:
    292
    Likes Received:
    399
    Reputations:
    16
    Сделайте дамп заголовков которые передает курл.

    Code:
    //Открываем файл для печати в него отладочной информации курла (Напечатаются все заголовки и данные которые мы отправляем)
           $fh_debug = fopen('curl_send_headers.txt','w');
    //Выставляете опцию которая говорит курлу что нужно заголовки запроса(которые он отправляет, записать в файл)
           curl_setopt($fp_curl_multi[$key_write_socket_curl], CURLOPT_VERBOSE, 1);
    //После curl_close() закройте отладочный дескриптор
    //Закрываем сеанс curl
          curl_close($fp_curl_multi[$key_write_socket_curl]); 
    //Закрываем отладочный дескриптор
          fclose($fh_debug); 
    В результате после работы курла в файле curl_send_headers.txt запишутся заголовки которые отправляет курл при отправке запроса.
     
    #3 kolia, 19 Jan 2013
    Last edited: 19 Jan 2013