Hi, hdb,
I tried your code, too. It actually looks like that :
my $ua = LWP::UserAgent->new(
'agent' => basename($0),
'timeout' => $TIMEOUT,
);
my $cookie_jar = HTTP::Cookies->new(
file => "perlcookie.txt",
autosave => 1,
ignore_discard => 1,
);
$ua->cookie_jar( $cookie_jar );
my $client = REST::Client->new( {
host => $url,
timeout => 10,
useragent => $ua,
follow => 1,
} );
$client->addHeader ("content-type", 'application/x-www-form-urlencoded
+');
$res = $client->POST(
"j_security_check",
"j_username=$username j_password=$password",
);
print Dumper ($res);
$res = $client->GET("api/14/system/info");
$rc = $client->responseCode ();
print Dumper ($res);
exit ( $rc);
And cookie file contains that
#LWP-Cookies-1.0
Set-Cookie3: JSESSIONID=node0npoji3aifa9r1c2xuxr6xvppe221132.node0; pa
+th="/"; domain=[SNIP]; path_spec; discard; HttpOnly; version=0
Unlike previous attempts, all HTTP transactions look good with this version of the code
Xavier
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.