vishnuvdev Posted December 13, 2011 Share Posted December 13, 2011 Hi, I'm trying to auto login to a website(created by me ;-) ) using the curl. as I am new to this I don't know how to make this possible. following is the code I tried but this is not submitting the data in the other site. the 'usr_name' and 'password' the field names in the page "http://localhost/myproject/users/login". and I have given a print_r in that site and it is displaying Array ( [loginType] => L [step] => confirmation [usr_name] => [email protected] [password] => test123 ) but not submitting the form. please help me.... this is the code i've tried..I got this from web... $login = "http://localhost/myproject/users/login"; $param="loginType=L&step=confirmation&[email protected]&password=test123"; $c = curl_init(); curl_setopt($c, CURLOPT_URL, $login); curl_setopt($c, CURLOPT_COOKIEJAR, "cookies.txt"); curl_setopt($c, CURLOPT_COOKIEFILE, "cookies.txt"); curl_setopt($c, CURLOPT_POST, 1); curl_setopt($c, CURLOPT_POSTFIELDS, $param); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1); echo curl_exec($c); thanks in advance.... Link to comment https://forums.phpfreaks.com/topic/253066-automatic-login-to-remote-website-using-curl/ Share on other sites More sharing options...
Winstons Posted December 13, 2011 Share Posted December 13, 2011 Maybe this help to you http://translate.google.com/translate?sl=ru&tl=en&js=n&prev=_t&hl=ru&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fphpforum.ru%2Findex.php%3Fshowtopic%3D50868&act=url Link to comment https://forums.phpfreaks.com/topic/253066-automatic-login-to-remote-website-using-curl/#findComment-1297433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.