Re: Issue with Outputting CURL Verbose Info to a File
Hi, Here is a compilable copy Thank you for the assistance, Chris On Wed, Feb 7, 2018 at 4:15 PM, Patrick Schlangenwrote: > Hi, > > > Do you think anything else could be causing this problem? > > could you send a full example (compilable)? > > Thanks, > > Patrick > > > > > --- > Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library > Etiquette: https://curl.haxx.se/mail/etiquette.html > // CurlExample.cpp : Defines the entry point for the console application. // #include #include "stdafx.h" #include // Access curl library from its location #include std::string serverName = "https://insertwebsitename.com;; // CHANGE bool curlPostFile(FILE ) { CURL *curl = curl_easy_init(); if (curl) { //connecting to the server curl_easy_setopt(curl, CURLOPT_URL, serverName.c_str()); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_STDERR, log); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_PORT, 443L); CURLcode curlReturn = curl_easy_perform(curl); std::cout << "Curl Return: " << curlReturn << std::endl; // always cleanup curl_easy_cleanup(curl); return true; } return false; } int main(int argc, char *argv[]) { FILE * logfile; fopen_s(, "log.txt", "wb"); curlPostFile(*logfile); fclose(logfile); return 0; } --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
AW: Issue with Outputting CURL Verbose Info to a File
Hi, > Do you think anything else could be causing this problem? could you send a full example (compilable)? Thanks, Patrick --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
Re: Issue with Outputting CURL Verbose Info to a File
Hi Patrick, Thanks for the tip, but sadly it still doesn't work for me. When I use a reference (&) all the verbose info gets displayed to the console, while with a pointer (*) it vanishes (not on the console or in the file). Do you think anything else could be causing this problem? Thanks for the assistance, Chris On Tue, Feb 6, 2018 at 5:08 PM, Patrick Schlangenwrote: > Hi, > > > but it never seems to output anything to the file > > try passing a FILE * to the curl_easy_setopt instead of a FILE &. > > Best Regards > > Patrick > > > > > --- > Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library > Etiquette: https://curl.haxx.se/mail/etiquette.html --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
AW: Issue with Outputting CURL Verbose Info to a File
Hi, > but it never seems to output anything to the file try passing a FILE * to the curl_easy_setopt instead of a FILE &. Best Regards Patrick --- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html
Issue with Outputting CURL Verbose Info to a File
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 ) { CURL *curl = curl_easy_init(); std::string read; struct curl_httppost *post; struct curl_httppost *postend; post = NULL; postend = NULL; curl_formadd(, , 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