Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^5: Correct link to put in my WWW:Mechanize

by Anonymous Monk
on Mar 12, 2022 at 19:00 UTC ( [id://11142039]=note: print w/replies, xml ) Need Help??


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

Also, this one does not point somewhere: http://www.csbio.sjtu.edu.cn/bioinf/MemBrain/cgi-bin/MEMBRAIN.cgi --> The requested URL /bioinf/MemBrain/cgi-bin/MEMBRAIN.cgi was not found on this server.

Replies are listed 'Best First'.
Re^6: Correct link to put in my WWW:Mechanize
by LanX (Saint) on Mar 12, 2022 at 19:07 UTC
    It's

    http://www.csbio.sjtu.edu.cn/cgi-bin/MEMBRAIN.cgi

    for the form's CGI!

    ... but without submitted form parameters it'll only return an error.

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

      Yes, of course, I added some:
      my $url = 'http://www.csbio.sjtu.edu.cn/cgi-bin/MEMBRAIN.cgi'; my $mech = WWW::Mechanize->new (timeout=>1000); $mech->get($url); $mech->submit_form ( form_number => 1, fields => { #textarea name | value S1 => ">$id\n$seq", #Radio button name | prediction type R4 => TOPpre, #Radio button SIGNAL | I do not know if I have a signa +l peptide R2 => SignalYES, #Radio button ORGANISM | Human, Plant, Animal, OEuk, G +pos, Gneg, R3 => Human, #Fill in email email => 'testmail@gmail.com' } );

        Your code is bad. You need to quote strings (hash values). Additionally S1 parameter looks a bit strange with the new line embedded - are you sure?

        Here is the curl equivalent of a successful run I did earlier (I broke the lines for readability). You can see that by opening developer tools on Firefox. I have done a successful submission using this from a Linux terminal:

        curl 'http://www.csbio.sjtu.edu.cn/cgi-bin/MEMBRAIN.cgi' -H 'User-Agen +t: XXX' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,imag +e/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: http://www.csbio.sjtu.edu.cn/bioinf/MemBrain/' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: http://www.csbio.sjtu.edu.cn' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: + 1' --data-raw 'mode=string&S1=NTLRVPDILALVIFAVVFLVGVLGNALVVWVTAFEAKRTINAI WFLNLAVADFLACLALPALFTSIVQHHHWPFGGAACSILPSLILLNMYASILLLATISADRFLLVFKPAW CQRFRGAGLAWILCAVAWGLALLLTIPSALYRVVREEYFPPKVLCGVDHDKRRERAVAIVRLVLGFLWPL LTLTICYTFILLRTWSARETRSTKTLKVVVAVVASFFIFWLPYQVTGIMMSFLEPSSPTFLLLKLDSLCV +S FAYINCCINPIIYVVAGQGFQKSLPELLREVLTEESVVR&R5=on&S2=&R4=TOPpre&TOPpre=on &R2=SignalYES&R3=Human&email=abc%40xyz.com&B1=Submit'

        You can infere a couple of things from the above: 1) the correct POST params from --data-raw. 2) No cookies are required. So either continue with Mech but use the correct url and POST params or use LWP::UserAgent with a browser-like user-agent string

        sarcasm on: if the cgi script you are accessing is also programmed by biologists all bets are on (off, whatever).

        bw, bliako

        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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142039]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-19 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found