How to post PUT request under the Windows using curl?

后端 未结 3 1898
挽巷
挽巷 2020-12-16 07:55

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

In the curl help I found:

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


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 08:41

    in windows you'll need to put the @ inside the quotes for the file you're sending:

    curl -XPUT --data-binary "@uploadme.txt"
    

    otherwise you'll get weird errors as it tries to use the content of the file as the url:

    curl: (6) Couldn't resolve host 'upload'
    curl: (6) Couldn't resolve host 'me!'
    

    (uploadme.txt contains "upload me!")

提交回复
热议问题