Answer the question
In order to leave comments, you need to log in
PHP cURL authorization on the site https://lk.ssl.mts.ru/, how to implement?
Help with the implementation of authorization in the MTS personal account, for the subsequent parsing of information ...
$login = 'XXXXXXXXX';
$pass = 'XXXXXXX';
$post = "IDToken2=".$pass."&IDButton=Submit&IDToken1=".$login."&encoded=false&loginURL=/amserver/UI/Login?gx_charset=UTF-8&csrf.sign=".$sign."&csrf.ts=".$ts;
$ch = curl_init();
$url = 'https://login.mts.ru/amserver/UI/Login';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);//Возврат строки
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "IDToken2=".$pass."&IDButton=Submit&IDToken1=".$login."&encoded=false&loginURL=/amserver/UI/Login?gx_charset=UTF-8&csrf.sign=".$sign."&csrf.ts=".$ts);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie1.txt'); // куки
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie1.txt');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36');
$result = curl_exec($ch);
Access restricted
Your browser is not supported.
Answer the question
In order to leave comments, you need to log in
Most likely there are normal checks from parsing. Try a more believable browser emulator . It's on node.js, unfortunately, but you can parse it on the node, and the rest is in php, as usual :)
I forgot about the headers (CURLOPT_HTTPHEADER) and the mts site refuses to accept parameters in CURLOPT_POSTFIELDS. Passed through CURLOPT_URL
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question