Search code examples
httpwgetput

wget how to send HTTP response to STD OUT or File when using post-file


I've been looking for some hours and I cannot find a solution for this.

I use wget to upload (HTTP PUT) a file to a server in this way:

/usr/bin/wget '--header=Content-Type: application/xml' '--post-file=/tmp/cda_initialParentApplication.xml' 'https://myserver.net:8443/remote/rest/v1/application?force=true' '--no-check-certificate' '--server-response' '--output-file=/wget_put.txt'

In general it works fine. The only thing is once the upload finishes, a new file containing the response is created:

... ... Saving to: ?application?force=true? 0K 100% 8.81M=0s

$more application\?force\=true <?xml version="1.0" encoding="UTF-8" standalone="yes"?><results><result updated="true" targetName="myApp"/></results>

Is there a way to avoid this response message to be created in that file?? Ideally send that response to STD OUT or to a specific file??

Thanks!


Solution

  • You could just redirect the output do /dev/null (and enable quiet) like this:

    wget --quiet -O /dev/null http://...