curl / Mailing Lists / curl-library / 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: Curl Get with XML

From: Aleksandar Lazic via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 3 Aug 2019 11:38:42 +0200

Hi.

Am 02.08.2019 um 22:40 schrieb Ken Ballentine via curl-library:
> I'm trying to use the following request from curl:

Please read the following blog post as you missues curl, from my point of view.
https://daniel.haxx.se/blog/2015/09/11/unnecessary-use-of-curl-x/

> Curl -X GET -k
> -I https://returns.usps.com/Services/ExternalCreateReturnLabel.svc/ExternalCreateReturnLabel?externalReturnLabelRequest
> <https://returns.usps.com/Services/ExternalCreateReturnLabel.svc/ExternalCreateReturnLabel?externalReturnLabelRequest=><ExternalReturnLabelRequest><CustomerName>Chris
> Brown</CustomerName<CustomerAddress1>901 D Street
> SW</CustomerAddress1><CustomerAddress2>Suite
> 101</CustomerAddress2><CustomerCity>Washington</CustomerCity><CustomerState>DC</CustomerState><CustomerZipCode>20024</CustomerZipCode><MerchantAccountID>3</MerchantAccountID><MID>201198</MID><LabelFormat>NOI</LabelFormat><LabelDefinition>3X6</LabelDefinition><ServiceTypeCode>020</ServiceTypeCode><AddressOverrideNotification>true</AddressOverrideNotification><CallCenterOrSelfService>Customer</CallCenterOrSelfService><ImageType>PDF</ImageType></ExternalReturnLabelRequest>
>
> It errors out at the first <.  If I paste this minus the curl commands directly
> into the rest client, it works fine.  I just need help formatting this so the
> curl can handle it.
>
>
> Please help.  Any assistance would be appreciated!

I suggest to put the xml into a file and run the following command.

curl -v --data-urlencode "externalReturnLabelRequest_at_XML-FILE"
https://returns.usps.com/Services/ExternalCreateReturnLabel.svc/ExternalCreateReturnLabel

For the syntax of --data-urlencode please take a look into the manpage
https://curl.haxx.se/docs/manpage.html#-d

> Thank you

Hth
Aleks

> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-08-03