Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to post PUT request under the Windows using curl?

I need to post XML data via curl.exe under windows using PUT request.

In the curl help I found:

-d/--data <data>   HTTP POST data (H)

What should I supply for <data>?

like image 745
sergtk Avatar asked Nov 28 '22 10:11

sergtk


2 Answers

curl sample calls

# with inlining plain data
curl -X PUT -d "payload" http://localhost
# referrring file
curl -X PUT -d @myXmlFile.xml http://localhost

If your windows curl-port does not support it go for cygwin. It is a linux-like environment for windows and also offers "a proper" curl.

like image 151
manuel aldana Avatar answered Dec 05 '22 19:12

manuel aldana


In windows, if a double-quoted argument itself contains a double quote character, the double quote must be doubled.

For example, enter 'This is "quoted" payload' as "This is ""quoted"" payload" which is very different than in Unix.

Example:

curl -X PUT -d "This is ""quoted"" payload" http://localhost
like image 36
Stefan Avatar answered Dec 05 '22 18:12

Stefan