Auto log in and auto surfing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
heya
Forum Newbie
Posts: 10
Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines

Auto log in and auto surfing

Post by heya »

How could I log in automatically at a page.. page requires username and password.
any suggestions?

thanks.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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 )
heya
Forum Newbie
Posts: 10
Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines

Post by heya »

well i just want to log in. when im logged in i could then access link that are only available to members.
Yns
Forum Newbie
Posts: 1
Joined: Thu Oct 06, 2005 4:27 am
Location: Turkiye

Post 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.
heya
Forum Newbie
Posts: 10
Joined: Thu Oct 06, 2005 2:53 am
Location: Manila, Philippines

Post by heya »

Thanks guys.
Post Reply