Thomas Thomas - 1 year ago 88
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?

Answer Source

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'

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download