| 56 | } |
| 57 | |
| 58 | CURLcode CURLWrapper::downloadText(const std::string &link, std::string &data) |
| 59 | { |
| 60 | data.clear(); |
| 61 | |
| 62 | if (!mCurl) { |
| 63 | return CURLE_FAILED_INIT; |
| 64 | } |
| 65 | |
| 66 | curl_easy_setopt(mCurl, CURLOPT_URL, link.c_str()); |
| 67 | curl_easy_setopt(mCurl, CURLOPT_WRITEFUNCTION, writeFunctionString); |
| 68 | curl_easy_setopt(mCurl, CURLOPT_WRITEDATA, &data); |
| 69 | curl_easy_setopt(mCurl, CURLOPT_SSL_VERIFYPEER, false); |
| 70 | curl_easy_setopt(mCurl, CURLOPT_USERAGENT, USERAGENT); |
| 71 | |
| 72 | return curl_easy_perform(mCurl); |
| 73 | } |
| 74 | |
| 75 | static size_t writeFunctionBinary (void *ptr, size_t size, size_t nmemb, void *stream) |
| 76 | { |
no test coverage detected