curl-users
Posting data
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