Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use wget to post a html form?

Tags:

html

wget

I have a form like this located at http://www.sms-online.web.id:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<body>

    <form method="post" enctype="multipart-form-data" name="my_form" onsubmit="clearTextBoxCounter()" action="http://www.sms-online.web.id/kirim" >

      <input type=hidden name=teks value=><center><b>KIRIM SMS GRATIS</b></center><br><br>
    Nomer:<br />
      <input type="text" maxlength="20" name="Phonenumbers" value="08888888"/>
      <br />

    <br />
    Isi:<br />
    <textarea rows="5" cols="50" onKeyPress=check_length(this.form); onKeyDown=check_length(this.form); name=Text >
    Content of my sms
    </textarea>
    <br />

    <input id="saveForm" class="btTxt" type="submit" value="KIRIM" name="TOMBOL" />

    </body>
    </html>

I would like to post to that form and then submit it, how do I use wget to do the job? I've read about wget --post-data xxx but I still don't know what I should type in in the terminal, based on that html file, should I type in like this? (I'm really not sure it'll work) wget --post-data value=08585858 textarea="Content of my sms" http://www.sms-online.web.id

like image 248
hillz Avatar asked Jan 12 '15 12:01

hillz


People also ask

Can you post with wget?

Wget does not currently support multipart/form-data for transmitting POST data; only application/x-www-form-urlencoded . Only one of ' --post-data ' and ' --post-file ' should be specified. Please note that wget does not require the content to be of the form key1=value1&key2=value2 , and neither does it test for it.

How does wget command work?

Wget is a networking command-line tool that lets you download files and interact with REST APIs. It supports the HTTP , HTTPS , FTP , and FTPS internet protocols. Wget can deal with unstable and slow network connections. In the event of a download failure, Wget keeps trying until the entire file has been retrieved.


1 Answers

From this SO question:

wget --post-data="value=08585858&textarea=\"Content of sms\"" <url>

Also check this.

like image 75
nhylated Avatar answered Oct 03 '22 06:10

nhylated