hi,
I've one of my asp websites and I want to run a daily scrapper to keep a track of all data.
Issue is that the site is in asp and on fetching the contents the contents is something in coded form.
I tried WWW::Mechanize but the same output in javascript and encoded form.
I tried WWWW::Mechanize::Firefox but it was not even able to login to the website, it simply says no such fields found
Then I go with HTML::TreeBuilderX::ASP_NET, but I could not understand exactly how to use it.
Even in mechanize I tried to post the __EVENTVALIDATION and __VIEWSTATEbut again No Luck there too.
Can anyone help me in this, posting here is the sample WWW::Mechanize program:
#!/usr/bin/perl
use WWW::Mechanize;
my $mech = WWW::Mechanize->new(autocheck => 0, autodie => 0);
$mech->agent('wonderbot/JS 1.0');
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get('https://XXXXX.aspx');
my $email = 'XXXX';
my $password = 'XXXX';
my $org_id = 'XXXXXX';
$mech->form_id('loginForm');
$mech->field('sUserName' => $email);
$mech->field('sPassword' => $password);
$mech->field('sParentUID' => $org_id);
#$mech->field('__EVENTVALIDATION' => $__EVENTVALIDATION);
#$mech->field('__VIEWSTATE' => $__VIEWSTATE);
$mech->click();
$mech->get('https://YYYY.aspx');#going to another link on the same web
+site
my $html_string = $mech->content();
print $html_string;
Code for WWW::Mechanize::Firefox:
#!/usr/bin/perl
use WWW::Mechanize;
my $mech = WWW::Mechanize->new(autocheck => 0, autodie => 0);
$mech->agent('wonderbot/JS 1.0');
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get('https://XXXXX.aspx');
my $email = 'XXXX';
my $password = 'XXXX';
my $org_id = 'XXXXXX';
$mech->form_id('loginForm');
$mech->field('sUserName' => $email);
$mech->field('sPassword' => $password);
$mech->field('sParentUID' => $org_id);
#$mech->field('__EVENTVALIDATION' => $__EVENTVALIDATION);
#$mech->field('__VIEWSTATE' => $__VIEWSTATE);
$mech->click();
$mech->get('https://YYYY.aspx');#going to another link on the same web
+site
my $html_string = $mech->content();
print $html_string;
Any help in this would be deeply regarded.
Thanks