I am trying to log into this url:
http://www.kalahari.com/marketplace/default.aspx
The two fields that are being submitted are labelled:
<
I wanted to give it a try and got your code working, see below. I have some var_dump and comments in the code as to what I am doing.
rawurlencode($viewstate),
"__EVENTVALIDATION" => rawurlencode($validation),
"ctl00%24ctl00%24ucMarketPlaceSupportNavigation%24txtMPTopSignInEmail" => rawurlencode($username),
"ctl00%24ctl00%24ucMarketPlaceSupportNavigation%24txtMPTopSignInPasswordTextNormal" => "Password",
"ctl00%24ctl00%24ucMarketPlaceSupportNavigation%24txtMPTopSignInPassword" => rawurlencode($password),
"ctl00%24ctl00%24ucMarketPlaceSupportNavigation%24btnSigninTop" => "Sign+in",
);
var_dump($postfields);
//I created the string myself for the post, else I got an error because we already encoded the variable names.
$p = "";
foreach($postfields as $k=>$v) {
$p .= $k.'='.$v.'&';
}
//do the new post
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $p);
$ret = curl_exec($ch);//Get result after login page.
//this contains 'You have entered an invalid password' so it works as expected.
var_dump($ret);
?>