Hi All,

I seem to be running into a problem when trying to output the verbose info
to a file. I have set it up to send using curl_easy_setopt(curl, CURLOPT,
file) as it shows on the website (the first 2 links below) but it never
seems to output anything to the file. I looked further into this problem
and found that someone had the same problem but the suggested solution only
seemed to work on Linux and not Windows (as seen in the 3rd link). I was
wondering if anyone had any knowledge of this being a problem on Windows
devices or a possible work around? I have attached a snippet of my code
below.

Thank you for your time and help

References:
https://curl.haxx.se/libcurl/c/CURLOPT_STDERR.html
https://curl.haxx.se/libcurl/c/CURLOPT_VERBOSE.html
https://stackoverflow.com/questions/38720602/getting-verbose
-information-from-libcurl-to-a-file
// Sends the request to the license server to validate activation
std::string testFile = "test.txt";

bool curlPostFile(FILE &log) {
	CURL *curl = curl_easy_init();
	std::string read;
	struct curl_httppost *post;
	struct curl_httppost *postend;

	post = NULL;
	postend = NULL;
	curl_formadd(&post, &postend,
		CURLFORM_COPYNAME, "userfile",
		CURLFORM_FILE, testFile.c_str(),
		CURLFORM_CONTENTTYPE, "text/plain",
		CURLFORM_END)

	//connecting to the server
	curl_easy_setopt(curl, CURLOPT_URL, postRequestURL.c_str());
	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
	curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L);
	curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);

	// This is against a local server so no need for SSL verification
	curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
	curl_easy_setopt(curl, CURLOPT_STDERR, log);
	curl_easy_setopt(curl, CURLOPT_CAINFO, "selfsignedcert.crt");
	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
	curl_easy_setopt(curl, CURLOPT_PORT, 443L);
	curl_easy_perform(curl);
	curl_easy_cleanup(curl);
	return true;
}
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to