First, sorry for my english. I have read for a long time the other answers for this argument, but without success.
I want to login on "https://webapp.wizards.com" to download a page, but in output I obtain the login page (and no error!).
Thank you!
This is the login form:
<form name="loginform" id="loginform" action="login.aspx" method="POST">
<input type="hidden" name="target" value=""><BR>
<table cellpadding="0" cellspacing="0" class="boxsearch">
<tr>
<td align="left" class="boxtitles" width="355">Member Login</td>
</tr>
<tr>
<td align="center" width="355" height="45">
<table cellpadding="2" cellspacing="2" align="center" valign="middle" width="355">
<tr>
<td align="right">Membership #:</td>
<td align="left">
<input type="text" name="dcinumber" id="dcinumber" value="" maxlength="10">
</td>
</tr>
<tr>
<td align="right">Password: </td>
<td align="left">
<input type="password" name="password" id="password" value="">
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="button" name="submitlogin" id="submitlogin" class="submitbutton" value="Login" onclick="document.loginform.submit();">
</td>
</tr>
</table>
</td>
</tr>
</table>
<input type="hidden" name="action" id="action" value="login">
And this my php code:
$cookie_path = "cookie.txt";
$user = "my_user";
$password = "my_password";
$url_login = "https://webapp.wizards.com/login.aspx";
$con = curl_init();
curl_setopt($con, CURLOPT_URL, $url_login);
curl_setopt($con, CURLOPT_RETURNTRANSFER, true);
curl_setopt($con, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($con, CURLOPT_POST, true);
curl_setopt($con, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)");
curl_setopt($con, CURLOPT_COOKIEJAR, $cookie_path);
curl_setopt($con, CURLOPT_COOKIEFILE, $cookie_path);
curl_setopt($con, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($con, CURLOPT_COOKIESESSION, true);
curl_setopt($con, CURLOPT_POSTFIELDS, array("dcinumber" => $user, "password" => $password));
$data = curl_exec($con);
if($data == false)
{
echo 'Error: ' . curl_error($con);
curl_close($con);
}
else
{
echo $data;
curl_close($con);
}