Hi,

Here is a compilable copy

Thank you for the assistance,
Chris

On Wed, Feb 7, 2018 at 4:15 PM, Patrick Schlangen <patr...@schlangen.me>
wrote:

> 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 <stdio.h>
#include "stdafx.h"
#include <Curl/curl.h> // Access curl library from its location
#include <iostream>

std::string serverName = "https://insertwebsitename.com";; // CHANGE


bool curlPostFile(FILE &log) {
	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(&logfile, "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

Reply via email to