cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-users Mailing List Archives

Posting data

From: BV <curl_at_vergato.com>
Date: Thu, 1 Apr 2004 14:36:06 -0800

I'm new to cURL and trying to understand the ways to POST data...

I want to be able to POST data both as a single blob and also via the read callback. I don't want to PUT files, or to post multipart form data:

Is the following correct to accomplish the two cases ?

// Post data via read callback...
 curl_easy_setopt(m_pCurl,CURLOPT_READDATA,this);
 curl_easy_setopt(m_pCurl,CURLOPT_READFUNCTION,staticCurlReadCallback);
 curl_easy_setopt(m_pCurl,CURLOPT_UPLOAD,1);
 curl_easy_setopt(m_pCurl,CURLOPT_POST,1);
 curl_easy_setopt(m_pCurl,CURLOPT_POSTFIELDS,0);

// Post data as a singne form encoded blob:
 curl_easy_setopt(m_pCurl,CURLOPT_POST,1);
 curl_easy_setopt(m_pCurl,CURLOPT_POSTFIELDS,pbData);
 curl_easy_setopt(m_pCurl,CURLOPT_POSTFIELDSIZE,iDataLen);
Received on 2004-04-02

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET