Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by bliako (Monsignor)
on Mar 13, 2022 at 12:14 UTC ( #11142070=note: print w/replies, xml ) Need Help??


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

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2023-01-30 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?