cURL / Mailing Lists / curl-users / Single Mail

curl-users

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

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

Thanks, but it's Windows unfortunately.

On Fri, Nov 20, 2015 at 11:08 AM, Dan Fandrich <dan_at_coneharvesters.com>
wrote:

> On Fri, Nov 20, 2015 at 10:47:54AM -0500, Jan Burger wrote:
> > 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?
>
> If you're using bash, this should work:
>
> curl --data @<(cat header.txt OperationsData.txt footer.txt) …
>
> >>> Dan
> -------------------------------------------------------------------
> 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
>

-------------------------------------------------------------------
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