玩过抓包,网络协议分析的朋友肯定都知道http https post get,web端和用户的交互主要是通过post get完成的。
今天带给大家的是C++版本的http https get post,只会易语言的朋友请移步。
我这里有两种实现:
1:libcurl实现的CHttpClient类,该类实现了Htpp和Https的get post方法。
2:winhttp实现的WinHttpClient类,同样也实现了Htpp和Https的get post方法。
看上去还不错吧!下面讲讲使用方法。
一:关于libcurl方式实现的CHttpClient注意事项。
1、ibcurl编译为静态库,代码生成选项,Debug版本请使用MTd,Release请使用MT。
2、预处理器请添加CURL_STATICLIB;
使用方法:
1、将curl文件夹和httpclient.h,httpclient.cpp拷贝到项目代码目录。
2、将项目目录下的httpclient.h,httpclient.cpp添加到项目中。
3、选中httpclient.cpp,不使用预编译头。
部署完成,使用如下
1、拷贝WinHttpClient文件夹到项目代码目录。
2、直接使用。
今天带给大家的是C++版本的http https get post,只会易语言的朋友请移步。
我这里有两种实现:
1:libcurl实现的CHttpClient类,该类实现了Htpp和Https的get post方法。
2:winhttp实现的WinHttpClient类,同样也实现了Htpp和Https的get post方法。
两者使用起来都很方便灵活。
运行部分效果图:
看上去还不错吧!下面讲讲使用方法。
一:关于libcurl方式实现的CHttpClient注意事项。
1、ibcurl编译为静态库,代码生成选项,Debug版本请使用MTd,Release请使用MT。
2、预处理器请添加CURL_STATICLIB;
使用方法:
1、将curl文件夹和httpclient.h,httpclient.cpp拷贝到项目代码目录。
2、将项目目录下的httpclient.h,httpclient.cpp添加到项目中。
3、选中httpclient.cpp,不使用预编译头。
部署完成,使用如下
1、拷贝WinHttpClient文件夹到项目代码目录。
2、直接使用。
完整Demo下载地址(VS2010项目):
http://download.csdn.net/detail/sunflover454/9170719