I am trying to automatically log in to a website using Perl with WWW :: Engine .
What am I doing:
$bot = WWW::Mechanize->new();
$bot->cookie_jar(
HTTP::Cookies->new(
file => "cookies.txt",
autosave => 1,
ignore_discard => 1,
)
);
$response = $bot->get( 'http://blah.foo/login' );
$bot->form_number(1);
$bot->field( usern => 'user' );
$bot->field( pass => 'pass' );
$response =$bot->click();
print $response->content();
$response = $bot->get( 'http://blah.foo' );
print $response->content();
The login works, but when I load the page, it tells me that I am not connected.
You see that I store cookies in a file. Now, if I restart the script without the login part, it says I'm connected ...
Does anyone understand this weird behavior?
Change . In fact, I noticed that the problem also occurs with some web browsers on a specific platform. The page says: "Not logged in." However, just reload the page to enter.
script get, . - .
, .