0
我在C++中使用libCurl向我的服務器發出一個xml文件的POST請求。該文章的作品,我收到我的服務器上的XML。然而,XML也有周圍的XML一個奇怪的頭&頁腳:使用libCurl POST添加未知的頁眉和頁腳
------------------------------b6966127f870Content-Disposition: form-data; name="myName"; filename="myFile.xml"Content-Type: application/xml<CORRECT XML FILE HERE>------------------------------b6966127f870--
這是什麼頁眉/頁腳?
我可以擺脫它嗎?或者我應該解析一下嗎?
捲曲添加這些?
下面是我發佈xml文件的相關curl調用。
void CurlUtils::postFileToURL(const char* const inFile,
const char* const urlString)
{
// Setup
CURL* const curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
// Post
struct curl_httppost* post = NULL;
struct curl_httppost* last = NULL;
curl_formadd(&post, &last,
CURLFORM_COPYNAME, "myName",
CURLFORM_FILE, inFile,
CURLFORM_END);
curl_easy_setopt(curl, CURLOPT_URL, urlString);
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
curl_easy_perform(curl);
// Cleanup ...
}