Z
Z
ZooX2015-10-30 18:44:08
PHP
ZooX, 2015-10-30 18:44:08

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);

Gives out:
Access restricted
Your browser is not supported.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Idel Gizatullin, 2015-11-05
@idelg

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 :)

P
Pavel Kuzmin, 2016-06-02
@s00d

I forgot about the headers (CURLOPT_HTTPHEADER) and the mts site refuses to accept parameters in CURLOPT_POSTFIELDS. Passed through CURLOPT_URL

E
etamin419, 2017-03-02
@etamin419

how did you get the values ​​in the $sign and $ts variables??

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question