curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Help Curl Windows

From: Jeremy Nicoll via curl-users <curl-users_at_cool.haxx.se>
Date: Tue, 19 Jan 2021 18:53:55 +0000

On Tue, 19 Jan 2021, at 08:47, Kepa (Lan-1000 S.L.) via curl-users wrote:

> curl --location --request POST
> 'https://pruesarrerak.bizkaia.eus/N3B4000M/aurkezpena' --header
> 'Accept-Encoding: gzip' --header 'Content-Encoding: gzip' --header
> 'Content-Length: 10950' --header 'Content-Type:
> application/octet-stream' --header 'eus-bizkaia-n3-version: 1.0'
> --header 'eus-bizkaia-n3-content-type: application/xml' --header
> 'eus-bizkaia-n3-data: { "con": "LROE", "apa": "1.1", "inte": { "nif":
> "99999999S", "nrs": "AAAAA", "ap1": "AAAAAAAAAA", "ap2": " AAAAAAAAAA "
> }, "drs": { "mode": "140", "ejer": "2020" } }" ' --data-binary '_at_/[Path
> and file to send] '
>
> But that code doesn't work with curl for Windows. Does anyone know how
> to modify that code to work with curl Windwos? There are problems with
> single commas and quotes.

By "single commas", do you mean single quotes, eg those in

  --header 'Content-Length: 10950' ?

According to the curl man-page, double quotes should work for those too.

Elsewhere, where you have literal double quotes inside the JSON (if that's
what it is) data strings, you'd probably have to put the whole string inside
outer double quotes and escape the inner ones, eg with the caret character,
eg

--header 'eus-bizkaia-n3-data: { "con": "LROE" ...

might become

--header "eus-bizkaia-n3-data: { ^"con^": ^"LROE^" ..

Whatever programming language you're using may simplify this or make it
more complicated.


Alternatively, I think it might be better if you write all the additional headers
into a temporary file and then specify that file name as a parameter to one
header option. That way you'd be able to see the exact values inside that
file rather than have to try to understand the values disguised by escape
sequences.


-- 
Jeremy Nicoll - my opinions are my own.
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-01-19