in reply to WWW::Mechanize and content length
At the last line, content length is blank and the $content holds the first 8192 bytes of the webpage. I can manually do the same steps within Chrome and dump the page and verify that $mech->content() only contains the first 8192 bytes of a 25k page. One thing to note, the <head> portion of the webpage contains a lot of javascript code.#!/usr/bin/perl use CSV; use WWW::Mechanize; my %OPTS = @LWP::Protocol::http::EXTRA_SOCK_OPTS; $OPTS{MaxLineLength} = 16384; # Or however large is needed... @LWP::Protocol::http::EXTRA_SOCK_OPTS = %OPTS; my $infile = $ARGV[0]; if (! -r $infile) { die "Can't read input $infile\n"; } # Start Mech and get it ready my $startPage = "https://xxxx.org/account/logon.jsp"; my $mech = WWW::Mechanize->new( cookie_jar => {},activate => 0,autoclo +se => 1,autodie =>0 ); $mech->get( $startPage ); $mech->post("https://xxxx.org//onerequest.jsp" , 'whatToDo' => "add", 'whereFrom' => "requestframe.jsp", 'whereTo' => "onerequest.jsp", ); sleep(2); print "Content length: " . $mech->response->header( 'Content-Length' ) + . "\n"; $content = $mech->content();
|
|---|