Hi
I'm facing a problem with curl as I am unable to issue a PUT request with inline XML data, I'm not sure how its done but I hade a couple of goes on it with different techniques. First I tried using the CURLOPT_UPLOAD
as its the default CURL option for PUT and tried to append the xml data manually:
typedef map<string, string> headers_t;
std::string strCommand = <XMLCOMMAND>
PUTRequest(param1, param2, ...)
{
...
headers_t headers;
int nLen = strCommand.length();
stringstream issLen;
issLen << nLen;
issLen >> strln;
curl_easy_setopt(curl, CURLOPT_UPLOAD, true); // HTTP PUT
headers.append("Content-Length: "+ strln); //
headers.append(strCommand);
...
}
Then I tried the same method but using the CURLOPT_POSTFIELDS
and CURLOPT_POSTFIELDSIZE
instead of manually appending the command to the HTTP headers.... did not work.
Then I tried customizing the PUT request using the CURLOPT_CUSTOMREQUEST
option and setting the parameter to PUT and also manually appending the command and using the POSTFIELDS method.
Sadly none worked and now I'm clueless as of what to try next.