#!/usr/bin/perl -w use lib qw( ..); use LWP::Debug qw(+ -cons); use LWP::UserAgent; use HTML::Form; use HTTP::Request::Common; my $url = "https://www.infoteldistributors.com/secure/b2blogin.asp"; my $login = "anemail\@yahoo.com"; my $passwd = "apassword"; my $ua = LWP::UserAgent->new; my $response = $ua->get($url); #login if (defined $response) { my @forms = HTML::Form->parse($response); my $form = @forms2; $form->value("EM",$login); $form->value("PW",$passwd); my $afterlogin = $ua->request( $form->click ); #infoteldistributors.com has a redirect immediately after login if($afterlogin->content =~ /get( "https://www.infoteldistributors.com/$redirurl" ); print "before foreach loop\n"; #extract all categories URLs foreach $1 ( $categpages->content =~ /new( $str => "$1", $scheme => "http" ); #my $req = HTTP::Request->new( GET => "http://$1" ); #$req->header( 'Accept' => 'text/html' ); ########### HERE IT CRASH ############# my $categResp = $ua->get( "https://$1" ); ########### HERE IT CRASH ############# print $categResp->content; #get category name $categResp->content =~ /(^<*) my $categ = $1; #get products foreach $1 ($categResp->content =~ /(^<*) /g){ my $title = $1; #get description $categResp->content =~ /(^<*) my $desc = $1; print "$categ | $title | $desc\n"; } } } else { #If an error occurs then $content will not be defined. print "Cannot get login page.\n"; }