cURL / Mailing Lists / curl-users / Single Mail

curl-users

POST data from multiple files without "&" in between them

From: Jan Burger <jan_at_burger.net>
Date: Fri, 20 Nov 2015 10:47:54 -0500

I'm really impressed with cURL and what it can do, but I'm struggling with
this feature:

-d, --data <data>

If any of these options is used more than once on the same command line,
the data pieces specified will be merged together with a separating
&-symbol. Thus, using '-d name=daniel -d skill=lousy' would generate a post
chunk that looks like 'name=daniel&skill=lousy'.

I'm trying to send a simple SOAP message with 1 element, the contents of a
text file, then I have two other files, header.txt and footer.txt (which is
the SOAP envelope), but the &-symbol in between the files messes things up:

curl --data @header.txt --data @OperationsData.txt --data @footer.txt "
http://soapserver:8080/soap/Nomination/SendNominations?datasetkind=%22Company%22&datasetname=%22ExternalReceive%22"
--libcurl debug.txt

gives this back from the receiving end:

XercesHandler.FatalError: line 1, column 308, message unterminated entity
reference

debug.txt has two offending &'s in CURLOPT_POSTFIELDS that I don't want.
Any way around this without changing the source code or writing a script
that concatenates the 3 files first?

Thanks!

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-11-20