Just put in the value of the variable that you want to change to get a new setting.

For example, in the NCBI CD-Search URL given above, the database selection variable name and the three possible values can be seen in the "View source" for the HTML page:
Search Database: <select NAME="DATALIB"> <option VALUE="oasis_smart"> Smart v3.3 - 569 PSSMs <option VALUE="oasis_pfam"> Pfam v6.6 - 3071 PSSMs <option VALUE="oasis_sap" SELECTED> All - 3693 PSSMs </select>
The variable name is DATALIB, with three possible values: oasis_smart, oasis_pfam, and oasis_sap. The SELECTED beside "oasis_sap" indicates that this is the default or selected value if the user does not change it.

So in your code, along with the SEQUENCE=>"$string" you also need a DATALIB=>'oasis_smart' if the Smart v3.3 database was to be the new target.

In fact, you can set all the POST parameters for the wrpsb.cgi page with code like this:
#!/usr/bin/perl use strict; use HTTP::Request::Common qw(POST); use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $string = ">CG2B_MARGL\n "; $string .= "MLNGENVDSRIMGKVATRASSKGVKSTLGTRGALENISNVARNNLQAGAK\n"; $string .= "KELVKAKRGMTKSKATSSLQSVMGLNVEPMEKAKPQSPEPMDMSEINSAL\n"; $string .= "EAFSQNLLEGVEDIDKNDFDNPQLCSEFVNDIYQYMRKLEREFKVRTDYM\n"; $string .= "TIQEITERMRSILIDWLVQVHLRFHLLQETLFLTIQILDRYLEVQPVSKN\n"; $string .= "KLQLVGVTSMLIAAKYEEMYPPEIGDFVYITDNAYTKAQIRSMECNILRR\n"; $string .= "LDFSLGKPLCIHFLRRNSKAGGVDGQKHTMAKYLMELTLPEYAFVPYDPS\n"; $string .= "EIAAAALCLSSKILEPDMEWGTTLVHYSAYSEDHLMPIVQKMALVLKNAP\n"; $string .= "TAKFQAVRKKYSSAKFMNVSTISALTSSTVMDLADQMC"; my $req=POST 'http://www.ncbi.nlm.nih.gov/Structure/cdd/wrpsb.cgi', [ SEQUENCE=>"$string", DATALIB=>'oasis_sap', INPUT_TYPE=>'fasta', EXPECT=>'0.01', FILTER=>'T', SMODE=>'0', NHITS=>'50', GRAPH=>'2', PAIR=>'2', GW=>'-1']; print "Content-type: text/html\n\n"; print $ua->request($req)->as_string();
Running this code as, say, sample.cgi in a Web server will return a rather impressive set of match options. Or just running from the command line as, say,
perl -w sample.cgi
will give the html source code on the screen.

Hope this helps. Good luck with this enterprise.

In reply to Re: Automated form submission by Speedy
in thread Automated form submission by dr_jgbn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.