Page 1 of 1

Auto log in and auto surfing

Posted: Thu Oct 06, 2005 2:55 am
by heya
How could I log in automatically at a page.. page requires username and password.
any suggestions?

thanks.

Posted: Thu Oct 06, 2005 3:51 am
by onion2k
Depends what you want to do. I wrote a script that logs into a forum and updates my signature every 15 minutes .. I used cURL. ( http://www.php.net/curl )

Posted: Thu Oct 06, 2005 4:23 am
by heya
well i just want to log in. when im logged in i could then access link that are only available to members.

Posted: Thu Oct 06, 2005 4:42 am
by Yns
Simple POST example with curl.

Code: Select all

<? 
$var1 = 'username';
$var2 = 'password';
 #start curl session
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,"http://www.site.com/test.php"); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"var1=$username&var2=$password");
curl_exec ($ch);
curl_close ($ch); 
?>
Details can bu found http://curl.haxxe.se or http://php.net/curl/ good luck.

Posted: Thu Oct 06, 2005 4:52 am
by heya
Thanks guys.