curl-library
RE: How to retrieve webpage from curl_easy_perform
Date: Tue, 3 Mar 2015 17:40:04 +0100
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
Received on 2015-03-03