Ingrese al sitio web usando PHP y CURL
Estoy intentando autologin parahttps://www.myicomfort.com/ para recuperar los datos. Probé algunos de los ejemplos publicados pero no parece funcionar. Tal vez no esté usando los nombres de campo correctos al pasar el nombre de usuario y la contraseña. ¿Puede alguien por favor ayuda? Sigo aprendiendo PHP. ¡Gracias!
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.myicomfort.com/");
curl_setopt($ch, CURLOPT_COOKIEFILE,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
$post_array = array(
'ctl00$RightContent$txtUserName'=>'xxxname',
'ctl00$RightContent$txtPwd'=>'xxxpassword',
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_array);
$output = curl_exec($ch);
curl_close($ch);
`