cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to retrieve webpage from curl_easy_perform

From: Josh Angstadt <josh_at_softgenetics.com>
Date: Tue, 03 Mar 2015 11:46:45 -0500

Hi, I tried to use the write options as well, but when I used those I
got an error from the connection, speciifcally error code 23

On 3/3/2015 11:40 AM, Patrick Monnerat wrote:
>
> Josh Angstadt wrote:
>> curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
>> curl_easy_setopt(curl, CURLOPT_READDATA, result);
> Your program is supposed to DOWNLOAD, isn't it ?
>
> The http://curl.haxx.se/libcurl/c/CURLOPT_READFUNCTION.html specifies:
>
> CURLOPT_READFUNCTION - read callback for data UPLOADS.
>
> You probably need to use
> http://curl.haxx.se/libcurl/c/CURLOPT_WRITEFUNCTION.html instead.
>
> If you just want to write received data to a file, use CURLOPT_WRITEDATA
> with the preopened FILE * (CURLOPT_WRITEFUNCTION is set to fwrite by
> default).
> If you want to process data before writing it somewhere, please see
> example http://curl.haxx.se/libcurl/c/getinmemory.html
>
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-03-03