We want to have a unique login form for different Softwares. We wrote a login form to get the username and password and send them to a ASP.Net software using curl and PHP like this:
define("COOKIE_FILE", "cookie.txt");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://192.168.100.1/webrest/default.aspx");
curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: 192.168.100.1'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,
array(
'txtUserName' => 'user',
'txtPassword' => 'pass',
'__VIEWSTATE' => '/wEPDwUKLTg1ODEyNzU0Mg9kFgICAw9kFgQCDw8PFgIeBFRleHQFMdmH2YTYr9uM2YbaryDYsdi02K8g2b7Yp9uM2K/Yp9ixINin24zYsdin2YbbjNin2YZkZAIRDw8WAh8ABZQB2KrZ',
'__VIEWSTATEGENERATOR' => '',
'__EVENTVALIDATION' => '',
)
);
$server_output = curl_exec ($ch);
echo $server_output;
curl_close ($ch);
But we can't login and get the source of login form again as output without any error! Can we get login and then send user to the target page like "http://192.168.100.1/webrest/reserve.aspx"?