I have a script with which I POST data to a server using cURL. When I use an HTML form to POST the same data, the POST looks something like this and all is well:
description=Something&name=aName&xml=wholeBiunchOfData&xslt=moreData
The XML and XSLT are large and change; I would prefer to maintain them in external files. However, the following does not work as I expect;
curl --cookie cjar --cookie-jar cjar --location --output NUL ^
--data "name=aName&description=Something" ^
--data "xml=@localFile.xml" ^
--data "xslt=@localFile.xslt" ^
http://someUrl.html
I have tried various combinations of the @ and local files without success. How do I POST the contents of a file?
I’d recommend trying the following:
XML (including stylesheets) will need to be URL-encoded before being made part of a URL.
You can also use
--trace-ascii -as an additional parameter to dump the input and output to standard out for further debugging, and you can find more information on the main man page.Hope this helps!