#include #include #include namespace bakaapi { // Callback function to write data into a std::string size_t WriteCallback(void* contents, size_t size, size_t nmemb, std::string* userp) { size_t totalSize = size * nmemb; userp->append((char*)contents, totalSize); return totalSize; } void login() { CURL* curl; std::string response; char url[] = "https://c-for-dummies.com/curl_test.txt"; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); curl_easy_perform(curl); // Perform the request std::cout << "this is responce: "<< response << std::endl; // Output the result curl_easy_cleanup(curl); // Cleanup } } }