[英]Can I automate AngularJS login form in Perl using WWW::Mechanize
这里是。 更改登录名和密码,然后粘贴您得到的内容。 您应该从API获取tokenId,然后使用此令牌进行授权。
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $login = 'lucky';
my $password = 'secretpassword';
$ua->default_header('Accept' => 'application/json, text/plain, */*');
$ua->default_header('Content-Type' => 'application/json;charset=UTF-8');
$ua->default_header('Accept-Encoding' => 'gzip, deflate, br');
$ua->default_header('Accept-Language' => 'pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7');
$ua->default_header('Connection' => 'keep-alive');
$ua->default_header('Orgin' => 'https://www.ooredoo.qa');
$ua->default_header('Referer' => 'https://www.ooredoo.qa/selfcare/');
$ua->default_header('Content-Type' => 'application/json;charset=UTF-8');
$ua->default_header('User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36');
my $content = '{"operation":"Login","language":"ENGLISH","parameters":["'.$login.'","'.$password.'"]}';
my $res = $ua->post('https://www.ooredoo.qa/webgate/login', Content => $content );
print $res->decoded_content;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.