Войти на сайт используя PHP и CURL
Я пытаюсь автологин кhttps://www.myicomfort.com/ чтобы получить данные. Перепробовал некоторые примеры, опубликованные, но, похоже, не работает. Может я'я не использую правильные имена полей при передаче имени пользователя и пароля. Может кто-нибудь, пожалуйста, помогите? Все еще изучаю PHP. Спасибо! `
$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);