久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Curl: Libcurl POST XML file URGENT help

 t涂鴉 2012-03-27

I am new to libcurl and I am trying to POST XML file (size up to 500 bytes).
I am giving the code below.

 

When I look at ethereal trace I don't see any data only header will be
there, I tried with sample string as length 500 considered as big. Still it
has same problem. I am not able to send even single character as data along
with HTTP1.1 POST.

 

I stuck with this problem and no clue since yesterday evening. I really
appreciate any one can give quick solution.

 

Thanks in advance,

 

Here is code chunk,

 

bool CControlStream::OpenCURLSession()

{

                curl_global_init(CURL_GLOBAL_ALL);

                m_pCURL = curl_easy_init();

 

                if (m_pCURL)

                {

                                // HTTP Authentication

                                curl_easy_setopt(m_pCURL, CURLOPT_HTTPAUTH,
CURLAUTH_DIGEST);

                                curl_easy_setopt(m_pCURL, CURLOPT_USERPWD,
m_strUserPassword.c_str());

 

                                // Set the URL that is about to receive our
POST. This URL can

                                // just as well be a https:// URL if that is
what should receive the data.

                                curl_easy_setopt(m_pCURL, CURLOPT_URL,
m_strURL.c_str());

 

                                return true;

                }

                else

                                return false;

}

 

void CControlStream::CloseCURLSession()

{

                if (m_pCURL)

                {

                                curl_easy_cleanup(m_pCURL);

                }

}

 

 

 

 

                OpenCURLSession();

                CURLcode res;

                ostringstream xrStream;

                m_pXmlRes.memory = NULL;

                m_pXmlRes.size = 0;

 

                LPDCS_ConferenceData pConfData
=(LPDCS_ConferenceData)pConference->pData;

 

                char sTmp[15];

                char test[30];

                char curlError[CURL_ERROR_SIZE+1];

                sprintf(sTmp,"%d",(pConfData->generic).ConferenceID.rid);

                CString sConfName = ((pConfData->generic).sResource).szName;

 

                m_MGCXmlParser.fnConfStartXmlMsg(sConfName, sTmp, xrStream);

 

                strcpy(test, "My Test libcurl Program");

 

                struct curl_slist *headers=NULL;

                headers = curl_slist_append(headers, "Content-Type:
text/xml");

 

                curl_easy_setopt(m_pCURL, CURLOPT_POST, 1);

 

                std::string strDoc = "xmldoc=" + xrStream.str();

 

                std::cout << strDoc.c_str() << std::endl;

                //curl_easy_setopt(m_pCURL, CURLOPT_POSTFIELDS, (char
*)strDoc.c_str());

                curl_easy_setopt(m_pCURL, CURLOPT_POSTFIELDS, (char *)test);

 

                /* we pass our 'chunk' struct to the callback function */

                curl_easy_setopt(m_pCURL, CURLOPT_WRITEDATA, (void
*)&m_pXmlRes);

 

                curl_easy_setopt(m_pCURL, CURLOPT_HEADER, 0 );

 

                curl_easy_setopt(m_pCURL, CURLOPT_WRITEFUNCTION,
libcurlCallback);

 

                curl_easy_setopt(m_pCURL, CURLOPT_ERRORBUFFER, curlError);

                curl_easy_setopt(m_pCURL, CURLOPT_NOPROGRESS, 1);

 

                /* pass our list of custom made headers */

                curl_easy_setopt(m_pCURL, CURLOPT_HTTPHEADER, headers);

 

                std::cout << strDoc.size() << std::endl;

                /* set the size of the postfields data */

                //curl_easy_setopt(m_pCURL, CURLOPT_POSTFIELDSIZE,
strDoc.size());

 

 

                /* Perform the request, res will get the return code */

                res = curl_easy_perform(m_pCURL);

 

                curl_slist_free_all(headers); /* free the header list */

 

                if(m_pXmlRes.size)

                {

                                ExtractTokens(m_pXmlRes);

                                free(m_pXmlRes.memory);

                }

 

                CloseCURLSession();

                return true;
Received on 2008-08-12

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報,。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多