in reply to Re^2: WWW::Mechanize - can't submit each value in an array
in thread WWW::Mechanize - can't submit each value in an array

What date?
  • Comment on Re^3: WWW::Mechanize - can't submit each value in an array

Replies are listed 'Best First'.
Re^4: WWW::Mechanize - can't submit each value in an array
by cheech (Beadle) on Jun 19, 2009 at 00:32 UTC
    The dates are contained in the array @dates. The first of which is 18960101.
      I've pointed out that if you *think* you send 18960101, you're actually sending 18960101 followed by a newline (which may or may not be the problem).
      #!/usr/bin/perl -- use strict; use warnings; use WWW::Mechanize; my @date = ( 18960101, "18960101\n", ); foreach my $date (@date) { my $mech = WWW::Mechanize->new(); $mech->agent_alias('Windows IE 6'); $mech->get("http://bub2.meteo.psu.edu/wxstn/wxstn.htm"); $mech->form_number(1); $mech->field( 'dtg', $date ); eval { $mech->click(); 1 } or print "$@\n", $mech->response->content, "\n"; print "-=> date => [$date] => ", $mech->status, "\n"; # my $file = "c:/perl/scripts/dates/$date.txt"; # $mech->save_content($file); $mech->back(); } __END__ -=> date => [18960101] => 200 Error POSTing http://bub2.met.psu.edu/cgi-win/WXDaily.EXE: Internal Er +ror at 2 line 14 <HTML><HEAD> <TITLE>Error in /cgi-win/WXDaily.EXE</TITLE> </HEAD><BODY> <H1>Error in /cgi-win/WXDaily.EXE</H1> An internal Visual Basic error has occurred in /cgi-win/WXDaily.EXE. <PRE>Bad file name or number (error #52)</PRE> <I>Please</I> note what you were doing when this problem occurred, so we can identify and correct it. Write down the Web page you were us +ing, any data you may have entered into a form or search box, and anything else that may help us duplicate the problem. Then contact the administrator of this service: <A HREF="mailto:wjs1@psu.edu"> <ADDRESS>&lt;wjs1@psu.edu&gt;</ADDRESS> </A></BODY></HTML> -=> date => [18960101 ] => 500
      No, what date does the error occur on?