Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   Болталка (https://forum.antichat.xyz/forumdisplay.php?f=46)
-   -   Помогите, народ. (https://forum.antichat.xyz/showthread.php?t=199174)

[ac1D] 25.04.2010 17:43

Помогите, народ.
 
Скрипт нормально гетит страницу, но пост запрос , видимо, не отсылается, что делаю не так??
PHP код:

<?php 
    $fp 
fsockopen('inbox.chmail.ru',80);
    if (
$fp)
    {
        
$headers "GET /register/ HTTP/1.1\r\n";
        
$headers .= "Host: inbox.chmail.ru\r\n";
        
$headers .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9\r\n"
        
$headers .= "Connection: Close\r\n"
        
$headers .= "Referer: http://chmail.ru/\r\n\r\n"
        
$line "";
        
fwrite($fp$headers);
        while(!
feof($fp))
        {
            
$line .= fgets($fp1024);
        }
        
preg_match('|<img src="(.*)" width=130 height=35 border=0>|mi'$line$out);
        
$captcha $out[1];
        echo 
'<img src="http://inbox.chmail.ru/'.$captcha.'">';
        print 
'
            <form method=get>
            <input type=text name=code> - Code<br>
            <input type=submit value="Go">
            </form>
        '
;
            
$name rand(100,1000);
            
$postdata "login=superman437842&domain=chmail.ru&passw1=debbidebi&passw2=debbidebi&question=%CA%E0%EA+%E7%EE%E2%F3%F2+%C2%E0%F8%F3+%F1%EE%E1%E0%EA%F3&answer=Mario&email=&name=Andone&gender=male&day=20&month=10&year=1989&country=Russia&city=Moscow&gmt=16&sec_code=".$_GET['code']."&agree=1&submit=%C7%E0%F0%E5%E3%E8%F1%F2%F0%E8%F0%EE%E2%E0%F2%FC%F1%FF";
            
$header "POST /register/ HTTP/1.1\r\n";
            
$header .= "Host: inbox.chmail.ru\r\n";
            
$header .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9\r\n";
            
$header .= "Referer: http://inbox.chmail.ru/register/\r\n";
            
$header .= "Content-Length: ".strlen($postdata)."\r\n";
            
$header .= "Connection: Close\r\n\r\n";
            
$header .= $postdata."\r\n\r\n";
            
fputs($fp$header);
            
$l "";
            while(!
feof($fp))
            {
                
$l .= fgets($fp1024); 
            }
            echo 
$l;                      
    }
?>


Mr.Replica 25.04.2010 17:55

может логин и пасс неправильные??

[ac1D] 25.04.2010 18:06

А, все разобрался))
Вот рабочий код:
PHP код:

<?php 
    $fp 
fsockopen('inbox.chmail.ru',80);
    if (
$fp)
    {
        
                    if (isset(
$_GET['code']))
            {
            
$name "Mario".rand(1111,9999);
            
$pass "mybestpass".rand(11,999999);
            
$postdata "login=".$name."&domain=chmail.ru&passw1=".$pass."&passw2=".$pass."&question=%CA%E0%EA+%E7%EE%E2%F3%F2+%C2%E0%F8%F3+%F1%EE%E1%E0%EA%F3&answer=Mario&email=&name=Andone&gender=male&day=20&month=10&year=1989&country=Russia&city=Moscow&gmt=16&sec_code=".$_GET['code']."&agree=1&submit=%C7%E0%F0%E5%E3%E8%F1%F2%F0%E8%F0%EE%E2%E0%F2%FC%F1%FF";
            
$header "POST /register/ HTTP/1.1\r\n";
            
$header .= "Host: inbox.chmail.ru\r\n";
            
$header .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9\r\n";
            
$header .= "Referer: http://inbox.chmail.ru/register/\r\n";
            
$header .= "Content-Length: ".strlen($postdata)."\r\n";
            
$header .= "Connection: Close\r\n\r\n";
            
$header .= $postdata."\r\n\r\n";
            
fputs($fp$header);
            echo 
"Login: $name<br>Password: $pass<br><a href=".basename(__FILE__).">Get new mail</a>";  
            }
            else  {
        
$headers "GET /register/ HTTP/1.1\r\n";
        
$headers .= "Host: inbox.chmail.ru\r\n";
        
$headers .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9\r\n"
        
$headers .= "Connection: Close\r\n"
        
$headers .= "Referer: http://chmail.ru/\r\n\r\n"
        
$line "";
        
fwrite($fp$headers);
        while(!
feof($fp))
        {
            
$line .= fgets($fp1024);
        }
        
preg_match('|<img src="(.*)" width=130 height=35 border=0>|mi'$line$out);
        
$captcha $out[1];
        
        echo 
'<img src="http://inbox.chmail.ru/'.$captcha.'">';
        print 
'
            <form method=get>
            <input type=text name=code> - Code<br>
            <input type=submit value="Go">
            </form>
        '
;
                
    }
    }
?>

До етого отправлялся не тот код, поэтому и не было реги


Время: 07:52