Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String activateWindow::get_response(char *url)
- {
- std::string result = "ello";
- CURLcode res;
- CURL *curl;
- curl = curl_easy_init();
- //Set the url.
- curl_easy_setopt(curl, CURLOPT_URL, url);
- //Direct it to our write function.
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &activateWindow::write_data);
- //Set our std::string. (where the data will be written)
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, result);
- res = curl_easy_perform(curl);
- curl_easy_cleanup(curl);
- return QString::fromAscii(result.c_str());
- }
- size_t activateWindow::write_data(void *ptr, size_t size, size_t nmemb, std::string *stream)
- {
- stream->append((char*)ptr);
- return size * nmemb;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement