Thomas Thomas - 8 months ago 39
Bash Question

How to fill a form in a web page automatically

I'm a new UNIX-Like system user and now I need to achieve such a function with script:

  • open an url

  • fill its form

  • click the submit button

I don't want to use any software to do this job. What I need is just running a script and finishing the job.

Can you give me a simple example?
For example, how to code a script to use Google automatically to search a key word?


You should look into cURL - you'll be able to post data to a URL / form action, something like:

curl -X POST -F 'formfield1=somedata' -F 'anotherformfield=moredata'