关于WINHTTP
MSDN中有这样的代码?请问是不是实现从vc程序中提交http请求,然后可以得到XML结果,那么asp如何返回XML?
void XMLHttpRequestSample()
{
IXMLHTTPRequestPtr pIXMLHTTPRequest = NULL;
BSTR bstrString = NULL;
HRESULT hr;
try {
hr=pIXMLHTTPRequest.CreateInstance("Msxml2.XMLHTTP.4.0");
SUCCEEDED(hr) ? 0 : throw hr;
hr=pIXMLHTTPRequest->open("GET", "http://XMLSampleServer/CatalogServer.asp
SUCCEEDED(hr) ? 0 : throw hr;
hr=pIXMLHTTPRequest->send();
SUCCEEDED(hr) ? 0 : throw hr;
bstrString=pIXMLHTTPRequest->responseText;
MessageBox(NULL, _bstr_t(bstrString), _T("Results"), MB_OK);
if(bstrString)
{
::SysFreeString(bstrString);
bstrString = NULL;
}
} catch (...) {
MessageBox(NULL, _T("Exception occurred"), _T("Error"), MB_OK);
if(bstrString)
::SysFreeString(bstrString);
}
}