cURL / Mailing Lists / curl-library / Single Mail

curl-library

cross-platform https

From: Daimen Duncan <daimen_at_gmail.com>
Date: Tue, 20 Jul 2004 11:48:09 -0400

Hi,

I'm new to curl and C in general, so please forgive the basic
questions (a search in the list archives might be nice ;). I chose to
work with libcurl because I need to POST data via SSL to a .jsp from a
C++ program that needs to run on both Windows and OS X. Unfortunately
I don't have a Mac yet, so I'm developing on Windows, but before I get
too deep I'm wondering if I could get some info and suggestions on
what will be required when I try to compile my code on OS X.

So here are my questions:
1) Has anyone on this list successfully compiled an https client on OS X?
2) Where do I get the OS X source distribution? The OS X link from
the libcurl download page takes me to a page with no downloads.
3) How different are the distributions? For example, on Windows,
there are required dlls... what, if anything, would be required on OS
X?
4) Am I correct in assuming that my 'main' code (below) would be the
same cross platform, only the includes would change?
5) And finally, regarding the below code... while it seems to work
fine (I get the correct response in res) are there other options I
should consider when using SSL? (Note: that the HTTPHEADER is
commented out since for some reason it throws an exception in
libcurl.dll).

TIA for any help or suggestions!

int main(void)
{

 CURL *curl;
 CURLcode res;

 curl = curl_easy_init();
 if(curl) {
       curl_easy_setopt (curl, CURLOPT_URL, "https://localhost/hello.php");
       curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 1);
       curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
       curl_easy_setopt (curl, CURLOPT_USERAGENT, "NetAuth Client v1.0");
       //curl_easy_setopt (curl, CURLOPT_HTTPHEADER, "Content-Type:
multipart/form-data;
boundary=---------------------------0029482318BE");
       curl_easy_setopt (curl, CURLOPT_POST, 1);
       curl_easy_setopt (curl, CURLOPT_POSTFIELDS,
"myVariable0=daniel&myVariable1=curl");

   /* Perform the request, res will get the return code */
   res = curl_easy_perform(curl);

  /* always cleanup */
   curl_easy_cleanup(curl);
 }

 cin.get();

 return 0;
}
Received on 2004-07-20