资源简介
玩过抓包,网络协议分析的朋友肯定都知道http https post get,web端和用户的交互主要是通过post get完成的。
我这里有两种实现:
1:libcurl实现的CHttpClient类,该类实现了Htpp和Https的get post方法。
2:winhttp实现的WinHttpClient类,同样也实现了Htpp和Https的get post方法。
两者使用起来都很方便灵活。
详细说明:
http://blog.csdn.net/sunflover454/article/details/49030803
代码片段和文件信息
// curlDemo.cpp : 定义控制台应用程序的入口点。
//
#include “stdafx.h“
#include
#include “WinHttpClient/WinHttpClient.h“
#include “httpclient.h“
using namespace std;
wstring UTF8ToUnicode( const string &str )
{
int len = 0;
len = str.length();
int unicodeLen = ::MultiByteToWideChar( CP_UTF8
0
str.c_str()
-1
NULL
0 );
wchar_t *pUnicode;
pUnicode = new wchar_t[unicodeLen + 1];
memset(pUnicode 0 (unicodeLen + 1)*sizeof(wchar_t));
::MultiByteToWideChar( CP_UTF8
0
str.c_str()
-1
(LPWSTR)pUnicode
unicodeLen );
wstring rt;
rt = ( wchar_t * )pUnicode;
delete pUnicode;
return rt;
}
int _tmain(int argc _TCHAR* argv[])
{
string strResponse;
//curl CHttpClient Test
CHttpClient client;
client.Get(“http://www.baidu.com“strResponse);
MessageBoxW(NULLUTF8ToUnicode(strResponse).c_str()L“http://www.baidu.com“MB_OK);
strResponse.clear();
client.Gets(“https://www.alipay.com“strResponse);
MessageBoxW(NULLUTF8ToUnicode(strResponse).c_str()L“https://www.alipay.com“MB_OK);
strResponse.clear();
client.Get(“http://so.baiduyun.me/search.php?wd=google“strResponse);
MessageBoxW(NULLUTF8ToUnicode(strResponse).c_str()L“http://so.baiduyun.me/search.php?wd=google“MB_OK);
strResponse.clear();
client.Post(“http://so.baiduyun.me/search.php““wd=google“strResponse);
MessageBoxW(NULLUTF8ToUnicode(strResponse).c_str()L“http://so.baiduyun.me/search.php?wd=google“MB_OK);
//winhttp WinHttpClient Test
WinHttpClient WinClient(L“https://itunes.apple.com/cn/lookup?id=527563481“);
WinClient.SetRequireValidSslCertificates(false);
WinClient.SendHttpRequest(L“GET“);
wstring httpResponseContent = WinClient.GetResponseContent();
MessageBoxW(NULLhttpResponseContent.c_str()L“http://www.baidu.com“MB_OK);
return 0;
}
相关资源
- Histamine excites rat lateral vestibular nucle
- Diltiazem augmented pentobarbital-induced LORR
- http请求状态代码
- 易语言post提交示例
- QT 实现文件下载
- 易语言 TCP使用HTTP、SOCKES5代理IP。
- postgresql驱动jar包
- Post Processing Profiles 3.1
- 易语言post登录DZX2论坛读个人资料源码
- http协议rfc2616中英文双版
- httpclient4.3工具类
- 谷歌浏览器插件Postman_4.1.3和安装流程
- Postman for chrome-V5.4.0_0汉化版
- 地址转化器 迅雷,电驴,网盘,快车
- apache-httpd2.5安装及配置(包含教程及
- 易语言HTTP连接请求源码
- okHTTP与HTTPS
- IE7,IE8下也能用的Httpwatch
- pkavhttpfuzzer
- Http Analyzer 7(http抓包工具)7 7.6.4破解
- Cimatron西门子专用后处理
- STM32+BC20通过HTTP传输GPS北斗定位到湖畔
- 易语言 HTTPS模块
- Netscaler中文配置手册.pdf
- Xenocode+Postbuild+2010+for+.NET程序混淆器(
- 利用openssl和curl库获取https服务端证书
- 通过NodeJS中的http.get() 和 http.requ
- IDEA遇到Internal error. Please refer to http
- RFC2616的中文版
- http服务器测试工具
评论
共有 条评论