in reply to Re^7: Correct link to put in my WWW:Mechanize
in thread Correct link to put in my WWW:Mechanize

you are still confusing the two URIs, see my explanation here.

The form is a part of the page you get°

Maybe you should read up on some HTTP/HTML basics first.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) that's the address you see in your browser, mechanize will extract the address of the CGI automatically if you specify which form to use.

  • Comment on Re^8: Correct link to put in my WWW:Mechanize

Replies are listed 'Best First'.
Re^9: Correct link to put in my WWW:Mechanize
by Anonymous Monk on Mar 12, 2022 at 19:24 UTC
    There is only one form on the page, so I thought it's enough what I write... Usually I had been able to use this script with minimal alterations, for instance for this page:
    http://www.compgen.org/tools/PRED-TMBB2

    (does not have CGI this one). So I think my confusion is created because of the CGI thing.
      WWW::Mechanize shows everything in the synopsis.

      adjust this

      use WWW::Mechanize (); my $mech = WWW::Mechanize->new(); $mech->get( $url ); # the address in your browser $mech->submit_form( form_name => 'search', # the form name in +the code fields => { query => 'pot of gold', }, # parameters button => 'Search Now' # button );

      I'm AFK now, TTYL.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        Hi Rolf, many thanks for trying to help out and apologies if I seem to not get it... I tried your code (which I think is pretty much what I have now), and the error still the same.
        use WWW::Mechanize(); while(<>) { if($_=~/^>(.*)/) { my $id=$1; my $seq=<>; chomp $seq; print "$id\n"; my $url = 'http://www.csbio.sjtu.edu.cn/bioinf/MemBrain/'; #what + I see in the browser, as you said my $mech = WWW::Mechanize->new(); $mech->get($url); $mech->submit_form ( form_name => 'myform', fields => { #textarea name | value S1 => ">$id\n$seq", #Radio button one with value (parameter 1) R4 => 'TOPpre', #Radio button one with value (parameter 2) R2 => 'SignalYES', #Radio button one with value (parameter 3) R3 => 'Human', #Fill in email (parameter 4) email => 'myemail@gmail.com' } ); } }

        The code executes until I print the id and then exits, with the error that I have posted earlier. I specified the form_name too, but nothing...