cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: install

From: rick vaillancourt <rick_vaillancourt_at_hotmail.com>
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:
http://111.111.111.111/cgi-forte/fortecgi?pagename=&serviceName=dev4&XMLData=<?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 =
"111.111.111.111/cgi-forte/fortecgi?pagename=&serviceName=dev4&XMLData=<?xml
version=/"1.0/" encoding=/"ISO-8859-1/"?><MyData field1=/"1/"
field2=/"2/"></MyData>"

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 */
    curl_easy_cleanup(curl);
  }
  return 0;
}

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

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

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

if(curl) {
   /* what URL that receives this POST */
   curl_easy_setopt(curl, CURLOPT_URL,
"http://curl.haxx.se/examplepost.cgi");
   curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
   res = curl_easy_perform(curl);

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

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
Received on 2002-01-05