Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
Greetings Monks,
Below is my code, dont know why it is not working.
use strict; use WWW::Mechanize; my $url = "http://www.truro-penwith.ac.uk/"; my $mech = WWW::Mechanize->new(); print "\nURL: $url ...\n"; eval{ $mech->agent_alias('Windows Mozilla'); #$mech->add_header('User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64; +rv:25.0) Gecko/20100101 Firefox/25.0'); #$mech->add_header('Accept'=>'text/html,application/xhtml+xml,applicat +ion/xml;q=0.9,*/*;q=0.8'); #$mech->add_header('Accept-Language'=>'en-US,en;q=0.5'); #$mech->add_header('Accept-Encoding'=>'gzip, deflate'); #$mech->add_header('Cookie'=>'bb2_screener_=1385998863+111.92.64.106; +PHPSESSID=078fc31740655a3a3f5fb280dbdf335d'); $mech->add_header('Connection'=>'keep-alive'); $mech->get($url); }; #$mech = $mech->content(); $mech = $mech->response->content(); print $mech; exit;
Anyone know what could be the proper reason.
Site is detecting this as a script, I tried adding headers with add_header & default_header, but nothing works. Response shows 400 Error and sometimes 403 Error. I wonder why this happened even though I had given the headers. Any ideas, I don't :(
Thanks in advance
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Perl mechanize get Error!
by PerlSufi (Friar) on Dec 02, 2013 at 20:32 UTC | |
by Anonymous Monk on Jan 04, 2014 at 08:26 UTC | |
by PerlSufi (Friar) on Jan 06, 2014 at 15:04 UTC | |
Re: Perl mechanize get Error!
by Anonymous Monk on Dec 02, 2013 at 17:25 UTC | |
by Anonymous Monk on Jan 04, 2014 at 08:23 UTC |
Back to
Seekers of Perl Wisdom