I am wanting to automate a login to a SSL website. I was advised to use WWW::Mechanize for this task. I have successfully created test scripts that login to basic authentication websites. I live in New Zealand and am wanting to access Telecom Jetstream usage information via a script rather than manually keying in information. I followed the following link (http://johnbokma.com/perl/https.html) to install Crypt::SSLeay which worked perfectly. However I am unable to be redirected to this page.
my $url = "https://www.telecom.co.nz/xtralogin.fcc?TYPE=33554433&REALM
+OID=06-0005cc45-3c3e-1f6c-93b5-80edbce40000&GUID=&SMAUTHREASON=0&METH
+OD=GET&SMAGENTNAME=$SM$bPLaid7UiFr%2fcTQchTKdU5ckPa0CnhjCk2Zds2Wopak%
+3d&TARGET=$SM$https%3a%2f%2fwww%2etelecom%2eco%2enz%2fjetstreamum%2fx
+tra";
my $mechanize = WWW::Mechanize->new(autocheck => 1);
$mechanize->cookie_jar(HTTP::Cookies->new);
$mechanize->get($url);
$mechanize->form_name('Login');
$mechanize->field('USER','digger');
$mechanize->field('PASSWORD','testpass');
$mechanize->click();
my $page = $mechanize->content;
open (FH, ">usage.html");
print FH $page;
close(FH);
Am i on the right track? Are there some websites that just won't allow this automation? Thank you very much for your time
Janitored by holli - added code tags
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.