纯C++的Socket访问Http封装类
时间:2010-10-15 来源:zgq_work
纯C++的Socket访问Http封装类
1.项目中要使用c++++来访问Web服务器,从网上找了个C++的封装类,其中调用了MFC,在VC2005上用能用,但是移植到VC2003就出问题了,干脆修改成了纯C++的,不敢独享,share之。
2.以下是调用方法:
#include "stdafx.h"
#include <iostream>
#include <string>
#include "httprequest.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Request myRequest; //初始化类
string sHeaderSend; //定义http头
string sHeaderReceive; //返回头
string sMessage=""; //返回页面内容
bool IsPost=false; //是否Post提交
int i =myRequest.SendRequest(IsPost, "
相关阅读 更多 +
排行榜 更多 +