Curl Login - Netlog

Discussion in 'PHP' started by Silver89, Jan 30, 2010.

  1. #1
    I'm trying to login to Netlog with the following but it's not doing what I'm expecting at the moment:

    (Username - Password removed)

    
    $login_email = "";
    $login_pass = "";
    
    
    $ch = curl_init(); 
    	
    	curl_setopt($ch, CURLOPT_URL, 'http://en.netlog.com/go/login'); 
    	curl_setopt($ch, CURLOPT_POSTFIELDS,'nickname='.urlencode($login_email).'&password='.urlencode($login_pass)); 
    	curl_setopt($ch, CURLOPT_POST, 1); 
    	curl_setopt($ch, CURLOPT_HEADER, 0); 
    	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
    	curl_setopt($ch, CURLOPT_COOKIEJAR, str_replace('\\','/',dirname(__FILE__)).'/net_cookies.txt'); 
    	curl_setopt($ch, CURLOPT_COOKIEFILE, str_replace('\\','/',dirname(__FILE__)).'/net_cookies.txt'); 
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    	curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 GTB5");
    	
    	$html = curl_exec($ch); 
    	
    	echo $html;
    
    curl_close($ch);
    
    PHP:
     
    Silver89, Jan 30, 2010 IP
  2. Bec0de

    Bec0de Well-Known Member

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    115
    #2
    You have to submit also the hidden fields:
    
    curl_setopt($ch, CURLOPT_POSTFIELDS,'action=login&target=-Lw__&nickname='.urlencode($login_email).'&password='.urlencode($login_pass));
    
    PHP:
     
    Bec0de, Jan 30, 2010 IP