curl login problem..

Discussion in 'PHP' started by nurulmac11, Jun 28, 2012.

  1. #1
    i wanna login on this page ;
    http://cerez.sozlukspot.com/ss_index.php?ne=login

    my codes(I added message page of this website at the end of login codes to understand if login or not.) also I entered website of their webpage. (http://cerez.sozlukspot.com/ss_index.php?ne=login) and still doesnt work..
    <a href="ss_index.php?sa=login&amp;ne=yap">enter</a> 
    <?php 
    
    $ne_yapacan=@$_GET['sa']; 
    function cerezegirelimmi($kullanici_adi, $sifre){ 
    
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, ' http://cerez.sozlukspot.com/ss_index.php?sa=login&amp;ne=yap'); 
    curl_setopt($ch, CURLOPT_POSTFIELDS,'kuladi='.urlencode($kullanici_adi).'&sifre='.urlencode($sifre).'&gonder=login&alme=77&sifresorma=3'); 
    curl_setopt($ch,CURLOPT_REFERER,'http://cerez.sozlukspot.com/ss_index.php?sa=login&amp;ne=yap'); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');  
    curl_exec($ch); 
    
    
    $html = curl_exec ($ch);  
    
    return $html; 
    
    curl_close($ch); 
    } 
    
    if(empty($_POST['gonder'])){ 
    ?> 
    <table border="0" cellpadding="0" cellspacing="0"> 
    <form action="ss_index.php?sa=login&amp;ne=yap" name="loginform" method="post"> 
    <tr> 
    <td width="300"> 
    
    <table border="0" cellspacing="1" > 
    <tr>  
    <td nowrap="nowrap">üye adı:</td> 
    </tr> 
    <tr> 
    <td><input name="kuladi" type="text" id="kuladi" value="" size="50" /></td> 
    </tr> 
    <tr>  
    <td>ÅŸifre:</td> 
    </tr> 
    <tr> 
    <td><input name="sifre" type="password" id="sifre" size="50" /></td> 
    </tr> 
    <tr>  
    <td><div align="right"><input name="gonder" type="submit" id="gonder" value=" login " /></div></td> 
    </tr> 
    </table> 
    <?php 
    }else{ 
    cerezegirelimmi($_POST['kuladi'],$_POST['sifre']); 
    } 
    ?><br /> 
    <br /> 
    <br /> 
    <br /> 
    <br /> 
    <br /> 
    <br /> 
    
    <?php 
    function cerez(){ 
    
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, 'http://cerez.sozlukspot.com/ss_index.php?sa=msj'); 
    
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
    
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');  
    $html = curl_exec ($ch);  
    return $html; 
    curl_close($ch);  
    } 
    $basl=cerez(); 
    echo $basl; 
    ?>
    PHP:

    thanks and sorry for my bad english :)
     
    nurulmac11, Jun 28, 2012 IP
  2. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #2
    I noticed the original login form has a HIDDEN field with an attribute you aren't submitting.
     
    NetStar, Jun 28, 2012 IP
  3. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #3
    Perhaps because you did not specify cookiejar/cookiefile option.
     
    gapz101, Jun 28, 2012 IP
  4. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #4
    true, cookiejar / cookiefile should exist on login system :)
     
    xrvel, Jul 2, 2012 IP