I just want to know, what difference it will make when I post using LWP and WWW::Mechanize. Below is what I experimented, which triggers this question.
Using LWPUsing WWW::Mechaniizeuse strict; use warnings; use LWP::UserAgent; use Data::Dumper; my $url = "http://192.168.1.5/src/Login_validate.php"; my $mech = LWP::UserAgent->new(); my $response=$mech->post($url,[ 'name' => "username", 'passwd' => "pas +sword"]); if(!$response->is_success()) { print "Failiure\n"; } print Dumper \$mech->get("http://192.168.1.5/src/allbooks.php"); __DATA__ In allbooks.php I checked if(isset($_SESSION['id']) and if not I print "Session expired" error m +essage. So when I executed the above code, it prints "Session expired" message +.
use strict; use warnings; use WWW::Mechanize; use Data::Dumper; my $url = "http://192.168.1.5/src/Login_validate.php"; my $mech = WWW::Mechanize->new(); my $response=$mech->post($url,[ 'name' => "username", 'passwd' => "pas +swd"]); if(!$response->is_success()) { print "Failiure\n"; } print Dumper \$mech->get("http://192.168.1.5/src/allbooks.php"); __END__ The above code print the html contents, echoed by allbooks.php and I'm + not getting the session expired message.
So can any one please explain why LWP and WWW::Mechanize works differently in my case?
The great pleasure in my life is doing what people say you cannot do.
In reply to DIfference between LWP and WWW::Mechanize by lakshmananindia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |