in reply to HTML::Form Submit Issue

Update: I looked closer at your code and the first issue is that you're never sending the filled out form back to the server:

# Update Form $forms[1]->click("update");

Use something like the following code, as suggested by the HTML::Form documentation:

my $filled_out_request = $forms[1]->click; print $filled_out_request->as_string; # for debugging, see below $response = $ua->request($filled_out_request);

Whenever automating access to a webpage, it is most important to replicate what the browser is sending. There are many tools nowadays to do that:

With any of these tools, the process is always to

  1. Get the original data sent by the browser
  2. Write a program to replicate it
  3. Compare the data sent by your program against the original data
  4. Repeat

Of course, I, as the author, think that my tools (Sniffer::HTTP and HTTP::Request::FromTemplate) are superior, but I use the other tools as well.

Replies are listed 'Best First'.
Re^2: HTML::Form Submit Issue
by initself (Monk) on Dec 09, 2005 at 08:42 UTC

    Thank you so much! I took the Live HTTP Headers from Firefox and compared them with what I was sending with:

    my $filled_out_request = $forms[1]->click; print $filled_out_request->as_string;

    I found what I was sending was correct. The trick was a) making the actual request with UserAgent (which 'click' alone does not do) and making sure cookies were setup properly.

    Hats off to Corion!