언어 설정

Menu
Sites
Language
how to download web content use curl lib

Hi, 

I want to download the content after I have done one curl perform;

 

curl_easy_perform(curl);

.....web content get here?

 

Responses

3 댓글
Vikram

Hi,

You can set the write function and write data buffer as below sample code.

char *buffer;
curl_write_callback writer;
...
curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(conn, CURLOPT_WRITEDATA, buffer);

 

Jean Yang

Hello, 

I have implemented the code of the example 

https://raw.githubusercontent.com/bagder/curl/master/docs/examples/getinmemory.c

The perform error code is 0, but the buffer is empty, seems no content returned, by the way , I used the https link, do you know where is wrong? thanks.

Vikram

Hi,

https need to certificate before content get. try to disable the certificate process.

curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, FALSE);