Maybe (I'm allmost convinced) that I the solution is quite easy but I can't see it.
I successfully load a form using UserAgent $ua.
With it comes a cookie that must be valid for the whole session.
I fillout the form and submit it by creating a new UserAgent $ub.
Within this 2. request the cookie is cheked many, many times!
And if the values of $ub aren't the same as of the first one
a new one is set and finally my last form is not accepted.
Again: during the three Requests: 1. Form, 2. Form and the final Fail/Success_Page
the value of the first cookie are many times (seen in traffic dump) checked.
My question now: How can I easily set the cookies of $ub and $uc to $ua
without saving and loading ev.thing to a file? This does not work:
$ub->cookie_jar = $ua->cookie_jar;
Thanks for your patience,
Carl
use HTTP::Cookies;
..
$ua = LWP::UserAgent->new;
$ua->agent($MOZILLA);
$ua->cookie_jar(new HTTP::Cookies);
$res = $ua->request(GET $url); #the $ua->cookie_jar is set hereafter
$post = &fillForm(\$res, \%FW, $form); # fillout form
# Creating a new UserAgent $ub
$ub = LWP::UserAgent->new;
$ub->agent($MOZILLA);
$ub->cookie_jar(new HTTP::Cookies);
$ub->cookie_jar = $ua->cookie_jar; #crash
# now this cookie of $ub has to be the same as of $ua
# I just don't get it and
# I don't want to save and load a file due to permissions
$res = $ub->request($post);
$post = &fillForm(\$res,\%FW,'msgO',$nSMS); # fillout next Form
# create 3rd UserAgent $uc
$uc = LWP::UserAgent->new;
$uc->agent($MOZILLA);
$uc->cookie_jar(new HTTP::Cookies);
$uc->cookie_jar = $ub->cookie_jar; #crash
# Again this cookie must be the same as
# the 2 others before
$res = $uc->request($post);
...
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.