SendRequest post后 后台接受不到数据
C语言代码
INTERNET_PORT nPort = 80;
DWORD dwRet = 0;
CInternetSession session;
CHttpConnection* pServer = session.GetHttpConnection(_T("1.guizhoujintongren.sinaapp.com"), nPort);
CHttpFile* pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST, _T("/serveAppointment/writeXML.php"));
CString strHeaders = _T("Content-Type: application/x-www-form-urlencoded;charset=UTF-8"); // 请求头
//开始发送请求
CString postData = _T("xml=yangfeng");
pFile->SendRequest(strHeaders,(LPTSTR)(LPCTSTR)postData,postData.GetLength());
pFile->QueryInfoStatusCode(dwRet);
后台测试代码PHP环境
<?php
$s = new SaeStorage();
$readXML = $_POST[‘xml’];
$s->write('kaipiao', 'test23.txt', $readXML);
echo $readXML;
?>
txt程序访问过TXT文本能正常生成 但是$readXML为空 用表单提交$readXML有数据