in reply to Re^2: Issue With WWW::Mechanize
in thread Issue With WWW::Mechanize

These are not the headers of the response.

On the other hand, this message means that the remote server encountered an error. It does not expect to handle the data you gave to it. Talk to the administrator of the remote program to find out what goes wrong and what you can do to get the results you want.

Replies are listed 'Best First'.
Re^4: Issue With WWW::Mechanize
by praveenzx (Novice) on May 23, 2012 at 04:54 UTC
    Hi Monks, I have fixed the issue by adding some headers . Now its working fine.
    #!/usr/bin/perl -w use strict; use WWW::Mechanize; use HTML::TreeBuilder; use Data::Dumper; my $mech = WWW::Mechanize->new(); my $url = 'http://www.etfsecurities.com/en/etfscalculations/etfsmsl.as +px?region=us'; $mech->agent_alias('Windows Mozilla'); $mech->add_header('Host' => 'www.etfsecurities.com'); $mech->add_header('Accept' => 'text/html,application/xhtml+xml,applica +tion/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('Connection' => 'keep-alive'); $mech->add_header('Cache-Control' => 'private'); $mech->add_header('Content-Type' => 'text/html; charset=utf-8'); $mech->get($url); print $mech->content(); open(WRT,">praveenzx.htm"); print WRT $mech->content(); close(WRT);
    thanks for you advice, praveenzx~