hi,
I'm trying to automate a login into one of our ancillary business partners.
their system is PHP and it seems they use a session cookie to validate the form being submitted.
I've tried to use the following code
Now i've dome some checking and printing to the screen and eveything works in terms of the mechanize loging in, however, when I then re-route the browser to the members area section, the browser displays the login page.
I'm assuming that the HTTP:Cookies , isn't actualy creating any of the cookies from the mechanize to the actual PC 'IE' cookies cache and so sees the attempt to go to the members area as invalid as the client doesn't seem to contain the session cookie.
Is there a way round this?
how can I automate a login to a website aquiring the required cookies for the session and login them in?
I really appreciate any input on this one!
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
I'm trying to automate a login into one of our ancillary business partners.
their system is PHP and it seems they use a session cookie to validate the form being submitted.
I've tried to use the following code
Code:
use [URL unfurl="true"]WWW::Mechanize;[/URL]
use HTTP::Cookies;
my $URL = "[URL unfurl="true"]https://$myurl/login.php";[/URL]
my $mech = [URL unfurl="true"]WWW::Mechanize->new();[/URL]
$mech->agent_alias( 'Windows IE 6' );
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get( $URL );
$mech->form_name( 'login' );
$mech->field( username => uc($user) );
$mech->field( password => $Pword );
$mech->click();
my $lnk = $mech->uri;
print "Location: $lnk\n\n";
exit();
Now i've dome some checking and printing to the screen and eveything works in terms of the mechanize loging in, however, when I then re-route the browser to the members area section, the browser displays the login page.
I'm assuming that the HTTP:Cookies , isn't actualy creating any of the cookies from the mechanize to the actual PC 'IE' cookies cache and so sees the attempt to go to the members area as invalid as the client doesn't seem to contain the session cookie.
Is there a way round this?
how can I automate a login to a website aquiring the required cookies for the session and login them in?
I really appreciate any input on this one!
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!