Code: Select all
wxCurlHTTP connection;
connection.Init();
connection.SetOpt(CURLOPT_AUTOREFERER, 1);
connection.SetOpt(CURLOPT_FOLLOWLOCATION, 1);
connection.SetOpt(CURLOPT_TIMEOUT, 10);
connection.SetOpt(CURLOPT_URL, url.fn_str());
connection.SetOpt(CURLOPT_USERAGENT, "MyUserAgent");
connection.SetOpt(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
connection.UseCookies(true);
//Direct deal with libCurl to for adding some headers.
curl_slist headerList;
curl_slist_append(&headerList, "Accept: text/html");
curl_slist_append(&headerList, "Accept-Language: ru-RU");
curl_slist_append(&headerList, "Accept-Encoding: gzip");
curl_slist_append(&headerList, "Accept: text/html");
curl_slist_append(&headerList, "Accept: text/html");
connection.SetOpt(CURLOPT_HTTPHEADER, headerList);
char buf[10000];
size_t read = connection.Get(buf);//Здесь как понимаю buf это приемник данных с запроса.
assert(read > 0);
...