$url = 'http://chempionik.tallanto.com/index.php?action=Login&module=Users';
$data = array("module" => "Users" , "action" => "Authentificate" ,
"return_module" => "Users" , "return_action" => "Login" ,
"cant_login" => "" , "login_module" => "Home" ,
"login_action" => "index" , "user_name" => "****@mail.ru" ,
"user_password" => "******" , "Login" => "Вход"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Opera 10.00");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_POST, true);
if($data)
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$html = curl_exec($ch);
echo $html;
?>
Ответ:
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.2.1
Date: Sun, 17 Jun 2018 11:10:16 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 0
Connection: keep-alive
X-Powered-By: PHP/5.4.45-0+deb7u2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=01a003d5f8a9eb1601f883d1039bcea7; path=/
Location: index.php?action=Login&module=Users&login_module=Users&login_action=Authentificate
Vary: Accept-Encoding
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Sun, 17 Jun 2018 11:10:16 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.4.45-0+deb7u2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: loginErrorMessage=LBL_SESSION_EXPIRED; expires=Sun, 17-Jun-2018 11:10:46 GMT; path=/; domain=chempionik.tallanto.com
Set-Cookie: sugar_user_theme=SuiteP; expires=Mon, 17-Jun-2019 11:10:16 GMT
Set-Cookie: loginErrorMessage=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/; domain=chempionik.tallanto.com
Vary: Accept-Encoding