hi,
I have to write some very weird login script. One of the things is that I have to use LWP::UserAgent->simple_request.
I can not use the normal ->get() 'cause it follow HTTP 301 Moved permanently response, i dont want to.
The other thing is that I want to manipulate the headers in the Mech object.
For the request partucalry i have to add headers before it has been created (from thee Mech point of view).
I already done the whole thing using directly HTTP::Request/Response, but I want to integrate it inside Mech, so that i continue with with it after the login..
In pesudo code current code is like this :
$req = new HTTP:Req(GET => url1);
$req->header('Cookie' => cookie1);
$resp = $mech->simple_request($req);
my $session = $resp->header('set-cookie');
$req2 = new HTTP:Req(GET => url1);#yes url1 again ;(
$req2->header('Cookie' => $session);
$req2->{_headers}->authorization_basic(user,pass);
$resp2 = $mech->simple_request($req2);
$req3 = new HTTP:Req(GET => url3);
$req->header('Cookie' => $session);
$resp3 = $mech->simple_request($req3);
done..continue with $mech only..
All this doesnt feel good ;|. I want req<->resp to be stored inside the $mech some way..and to be able to continue processing with mech.
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.