Hi Experts,
Hi Experts, need help to create perl script to login to one url using perl script and again i have to use that url to pass the userid for further actions.
Please help me with the script to login into the test url with username and password and again i have to use that url
Ex:
sub remove{
my ($user) = shift;
my $ua = new LWP::UserAgent;
$ua->agent('Mozilla/4.5');
## HERE I HAVE TO LOGIN INTO http://test.com/ THIS url using u
+sername:test and password:test
my $url_arg = '';
if ($ENV=~ /^Dev/i) {
$url_arg = "http://test.com/test?USERID=$user";
}
my $url = URI::URL->new($url_arg);
my $req = HTTP::Request->new ('GET',$url);
$res = $ua->request($req);
if ($res->is_success)
{
return $res;
}else
{
print "Content-type:text/html \n\n";
print $res->error_as_HTML;
}
exit 0;
}
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.