16,372
社区成员




#include <iostream>
#include <afxinet.h>
#include "des.h"
int main()
{
//发送http请求
CInternetSession m_session("Webservice32");
CString HttpResponse;
try
{
CString strData;
char *requestUrl="http://221.176.197.13:8011/Api!DeviceIdentify.do?account=test&password=111111&macno=000011&samno=123456";
CHttpFile *pFile;
pFile = (CHttpFile *) m_session.OpenURL(requestUrl);
DWORD Code;
pFile->QueryInfoStatusCode(Code);
if(Code!=200)
{
printf("找不到主页!");
return 0;
}
char ch;
while(pFile->Read(&ch,1))
{
printf("%c",ch);
}
pFile->Close();
}
catch(CInternetException* e) //捕获异常
{
TCHAR pszError[200];
e->GetErrorMessage(pszError, 200);
e->Delete();
printf("异常!");
return 0;
}
m_session.Close();
return 0;
}