- 3
- 0
- 约1.64万字
- 约 15页
- 2018-06-07 发布于福建
- 举报
纯CSocket访问Http封装类
纯C++的Socket访问Http封装类
纯C++的Socket访问Http封装类
1.项目中要使用c++++来访问Web 服务器,从网上找了个C++的封装类,其中调用了MFC,在VC2005上用能用,但是移植到VC2003就出问题了,干脆修改成了纯C++的,不敢独 享,share之。
2.以下是调用方法:
#include?stdafx.h?
#include?iostream?
#include?string?
#include?http\request.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,?,?sHeaderSend,?
sHeaderReceive,?sMessage
原创力文档

文档评论(0)