cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to capture Error message from the Server

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 17 May 2016 16:19:55 -0400

On 5/17/2016 3:40 PM, Colin Ngam wrote:
> Yes, but if the Server is also sending additional text of the error where can I capture this in the situation of the GET e.g.
> <?xml version="1.0" encoding="UTF-8"?>
> <Error><Code>NoSuchKey</Code><Message>The specified key does not
> exist.</Message><Key>smC1842A51E22A05000000000000A386410000000100003J7M3CMY9CMULJKG6Q</Key><RequestId>B09B6836031219A8</RequestId><HostId>GIxwOGJB8DMKoIxYcqNkRDL/a1rcrPyg7hmMx+UNNtvUVgaOILdjCMe/ntfo/+bIxWG1D5ws7SU=</HostId></Error>
>
>
> Currently, what we are doing is comparing the string "<?xml version=“ and saving the buffer just in case of an error overtime the callback is entered.

You'll have to parse that using an XML parser (eg xmlReadMemory [1][2]
in libxml2), libcurl doesn't do that for you.

[1]: http://xmlsoft.org/html/libxml-parser.html#xmlReadMemory
[2]: http://www.xmlsoft.org/examples

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-05-17