in reply to Re: WWW::Mechanize::GZip and post() Issue
in thread WWW::Mechanize::GZip and post() Issue

When i manually try the website works fine. I am new to perl can you please be more clear about this "Compare the two using LWP::Debug and the Mozilla HTTP Live Headers extension for example."
  • Comment on Re^2: WWW::Mechanize::GZip and post() Issue

Replies are listed 'Best First'.
Re^3: WWW::Mechanize::GZip and post() Issue
by Corion (Patriarch) on Aug 07, 2016 at 19:11 UTC

    Let me repeat myself:

    Does the site work when you use the "normal" WWW::Mechanize instead?

    By this, I mean to remove the mentions of WWW::Mechanize::GZip and replace them by WWW::Mechanize.

    WWW::Mechanize (and likely, WWW::Mechanize::GZip) are derived from LWP::UserAgent and thus the approach outlined in LWP::Debug will work for them to dump the outgoing HTTP requests and the responses you get.

    This is one side of the comparison. The other side, you can get for example by using the Mozilla HTTP Live Headers extension.

    Compare the output of your program (resp. the dumped headers) with the headers you capture when manually navigating the site. Change your script until there are no more differences.

      #!/usr/bin/perl use WWW::Mechanize::GZip; `cat /dev/null > /var/www/html/r.out`; $m=`date --date="0 days ago" +'%-m'`; $m=~ s/\n//g; $d=`date --date="0 days ago" +'%-d'`; $d=~ s/\n//g; $y=`date --date="0 days ago" +'%-Y'`; $y=~ s/\n//g; $start=$m."/".$d."/".$y; #$start=trim($start); my $mech = WWW::Mechanize::GZip->new(); $response = $mech->post("http://domain.com/affiliates/login.ashx?tp=1" +,[u=>'xxxxxx',p=>'yyyyyyy']); $response = $mech->post("http://domain.com/affiliates/Extjs.ashx?s=sub +affsummary",[start_date=>'8/7/2016',end_date=>'8/7/2016',csv=>'1']); $mech->save_content("/var/www/html/uv__$y$m$d.csv"); print $response->content();
      //this my script. Kindly guide me