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


In reply to Perl mechanize get Error! by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.