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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|