cURL / Mailing Lists / curl-library / Single Mail

curl-library

Problem using RECORDFUNCTION

From: Jon Lederman <jonlederman_at_gmail.com>
Date: Mon, 2 Jun 2014 08:50:54 -0400

Hi All,

I am trying to mimic the following command line curl request in libcurl programatically in C/C++. Instead of reading data from a file though, I want to send binary data from a buffer in memory:
curl "https://website.net:443/Command?appId=XXX&appKey=YYY5&id=ZZZ" -H "Content-Type: AAA;codec=BBB" -H "Accept-Language: ENUS" -H "Transfer-Encoding: chunked" -H "Accept: application/xml" -H "Accept-Topic: New" -k --data-binary @data.bin -v

I am using post-callback.c as a model. I am have set up the headers correctly. What I don’t fully understand is how to use READFUNCTION. When I use the technique in post-callback, I get the following error below. Could you point me to an example of how to use READFUNCTION with binary data from a buffer? I would like to see more examples.

Thanks in advance.

<
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 500 x-a-sessionidf38693fc-e97b-4d43-abea-907790367183
Received QueryRetry: 2 AUDIO_INFO</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /XXX. Reason:
<pre> x-XXX-sessionidf38693fc-e97b-4d43-abea-907790367183
Received QueryRetry: 2 AUDIO_INFO</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>

</body>
</html>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-02