booy has asked for the wisdom of the Perl Monks concerning the following question:

I want to submit some jobs to the web site "http://www.jcat.de/" using perl. I writted a script using the LWP, but it always produce a 500 internal server error. I can not figure out how to do correctly.

The select form looks like this:

<option value="330 Escherichia coli O6:K15:H31 (strain 536 / UPEC)">Escherichia coli O6:K15:H31 (strain 536 / UPEC)</option>

<option value="40 Escherichia coli O6 (strain UPEC / O6:H1 / ATCC 700928 / CFT073)">Escherichia coli O6 (strain UPEC / O6:H1 / ATCC 700928 / CFT073)</option>

<option value="317 Escherichia coli (strain ATCC 27325 / DSM 5911 / W3110 / K12)">Escherichia coli (strain ATCC 27325 / DSM 5911 / W3110 / K12)</option>

my $browser = LWP::UserAgent->new; my $url = "http://www.jcat.de/Result.jsp"; #submit my $response = $browser->post( $url, [ 'Sequence' => $ori_seq,#42 Escherichia coli (strain K12) 'seq_type' => 'DNA', 'genome' => '42 Escherichia coli (strain K12)', 'hairpin' => 'checked', 'quickChange' => 'checked', ]);

Replies are listed 'Best First'.
Re: A problem in submitting select form with LWP
by jellisii2 (Hermit) on Jan 23, 2014 at 12:51 UTC
    Verify the data that you're sending matches what the site actually expects. There's a hidden value that you're not setting that may or may not be required. I also can't remember if values in a post need to be html entities or not...
      Thank you for your suggestion. It is the right point.
Re: A problem in submitting select form with LWP
by tangent (Parson) on Jan 23, 2014 at 13:47 UTC
    As jellisii2 mentions you do need to include the hidden field 'translationNo'. This worked for me:
    my $response = $browser->post( $url, { 'Sequence' => '42 Escherichia coli (strain K12)', 'seq_type' => 'DNA', 'genome' => '42 Escherichia coli (strain K12)', 'hairpin' => 'checked', 'quickChange' => 'checked', 'translationNo' => 1, } );
      It do work! Thank you so much.