cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP POST from memory...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 19 Jun 2002 14:21:14 +0200 (MET DST)

On Wed, 19 Jun 2002, SHIRETU wrote:

> I've created an XML and I don't want to write it in a FILE * and then POST
> that FILE *. I just want to POST it directly.

int postdata(char *url, char *data, int sizeofdata)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, url);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
    curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, sizeofdata);
    res = curl_easy_perform(curl);

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

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
----------------------------------------------------------------------------
                   Bringing you mounds of caffeinated joy
                   >>>     http://thinkgeek.com/sf    <<<
Received on 2002-06-19