I've been trying to autologin on a remote site using PHP/cURL and then perform further actions within that session.
However, my script doesn't seem to work out.
The client site uses a simple post form:
<form method=post style="display: inline" action=login.php> <input type=text size=10 name=name>
<input type=hidden name=betapass value=348759304
<input type=Password size=10 name=pass>
<input type=submit value=Login></form>
First I post my name and pass and use the fixed betapass.
When I manually login I get forwarded to index.php, but when I perform this script I get the login page!
What's going wrong here?
$url = "http://www.barafranca.nl/login.php";
$params = "name=MYNAME&betapass=348759304&pass=***";
$referer = "http://www.site.com/";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_REFERER, $referer );
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_exec ($ch);
curl_setopt($ch, CURLOPT_URL,"http://www.site.com/index.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
$fres = curl_exec ($ch);
curl_close ($ch);
echo($fres);