How can I use wget to send POST data?

10

3

I want to make following POST request to my server using wget:

email=abc@abc.com&file1=@FILE_HERE&file2=@FILE_HERE

In the above request, there are three POST parameters called email , file1 and file2 where email contains email of user and file1 , file2 contain a file.

How can I send it using wget? I don't want to use curl.

Ashish

Posted 2015-03-07T22:10:46.667

Reputation: 131

Answers

11

Use the --post-data parameter.

So your command will end with:

--post-data "email=abc@abc.com&file1=@FILE_HERE&file2=@FILE_HERE"

Just Lucky Really

Posted 2015-03-07T22:10:46.667

Reputation: 926

1

Another method is to put your data in a file. For example, if you saved a file called params.txt as:

email=abc@abc.com
file1=@FILE_HERE
file2=@FILE_HERE

You could use --post-file params.txt

Stewart

Posted 2015-03-07T22:10:46.667

Reputation: 253