cURL / Mailing Lists / curl-library / Single Mail


Re: install

From: rick vaillancourt <>
Date: Fri, 04 Jan 2002 17:38:12 -0500

Hi all-

+1st off, this program worked successfully with my previous example (I
needed the IP addr rather than host name). The slow part was it couldnt
find the address, it was quite quick when it actually had an address it
could understand. THANKS!

+I then tried a different url, from the browser I can put in the request
string below, everything works OK...

+ the string:<?xml
version="1.0" encoding="ISO-8859-1"?><MyData field1="1" field2="2"></MyData>

+I modified the simple.c program to take the following:

int main(int argc, char **argv)
  CURL *curl;
  CURLcode res;
  FILE *headerfile;

I made this a char* instead of hard coding the curl_easy_setopt cmd,
I added slashes in front of the double quotes

char *theURL =
version=/"1.0/" encoding=/"ISO-8859-1/"?><MyData field1=/"1/"

curl = curl_easy_init();
  if(curl) {

/* <---- output char* looks ok, works in browser with http:// prefix*/
        fprintf(headerfile, theURL);

        curl_easy_setopt(curl, CURLOPT_URL, theURL );
        curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile);
            res = curl_easy_perform(curl);

    /* always cleanup */
  return 0;

//////////////////// this is what comes to the console???

<BODY><H1>Bad request</H1>
Your browser sent a query this server could not understand.

//////////////////// Do I need to use this format shown in postit.c

if(curl) {
   /* what URL that receives this POST */
   curl_easy_setopt(curl, CURLOPT_URL,
   curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
   res = curl_easy_perform(curl);

/////////////////////// Thanks. Rick

Chat with friends online, try MSN Messenger:
Received on 2002-01-05