Hi Monks,
I'm trying to automate the process of getting some information from a site that requires authentication to get in (the logging in part I've done).
Once logged in I get presented a page in the browser which I can then click the link I want to get sed information. Looking at the html of the page I get from logging in has snippets like...
<a href="www.mysite.com?thing={VALUE}">click me</a>
The {VALUE}, I assume is an environment variable that is sent back after logging in which then gets passed along to the next link when I click it.
My problem is displaying the values of these variables. I've tried dumping the environment variables through ENV, but they're not there?
I'm using LWP::Useragent to login me into the site with HTTPS, is there a LWP method that will print them?
i.e.
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
user LWP::Debug qw (+);
#Simplified a little bit as real site requires cookies and url redirec
+tion etc...
my $ua = LWP::UserAgent->new;
my site = "https://www.secure.com/login";
my $req = HTTP::Request->new(POST => $site);
my $req->content_type('application/x-www-form-urlencoded');
my $req->content('user=a_user&pass=a_pass');
my $req = $ua->request($req);
if ($res->is_success) {
print $res->content;
} else {
print $res->status_line, "\n";
}
#Now how do I dump the var=value pairs from this returned page???
Thanks for the advice,
Regards Paul
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.