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

Ah sorry.. here's the error returned:

Uncaught exception from user code: Error POSTing http://bub2.met.psu.edu/cgi-win/WXDaily.EXE: Internal Erro r at C:\Perl\scripts\i.pl line 21 at C:/Perl/lib/WWW/Mechanize.pm line 2615 WWW::Mechanize::_die('Error ', 'POST', 'ing ', 'URI::http=SCALAR(0x237c6 3c)', ': ', 'Internal Error') called at C:/Perl/lib/WWW/Mechanize.pm line 2602 WWW::Mechanize::die('WWW::Mechanize=HASH(0x229b7a4)', 'Error ', 'POST', 'ing ', 'URI::http=SCALAR(0x237c63c)', ': ', 'Internal Error') called at C:/Perl /lib/WWW/Mechanize.pm line 2261 WWW::Mechanize::_update_page('WWW::Mechanize=HASH(0x229b7a4)', 'HTTP::Re quest=HASH(0x249be6c)', 'HTTP::Response=HASH(0x24a9ba4)') called at C:/Perl/lib/ WWW/Mechanize.pm line 2117 WWW::Mechanize::request('WWW::Mechanize=HASH(0x229b7a4)', 'HTTP::Request =HASH(0x249be6c)') called at C:/Perl/lib/WWW/Mechanize.pm line 1642 WWW::Mechanize::click('WWW::Mechanize=HASH(0x229b7a4)') called at C:\Per l\scripts\i.pl line 21

  • Comment on Re^2: WWW::Mechanize - can't submit each value in an array

Replies are listed 'Best First'.
Re^3: WWW::Mechanize - can't submit each value in an array
by Anonymous Monk on Jun 19, 2009 at 00:20 UTC
    What date?
      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?