调用方式
HttpConnect *http = new HttpConnect();
string result = http->getData("域名或者ip地址", "请求路径如:/login", "参数如:channelId=1&index=1");
result = http->postData("域名或者ip地址", "请求路径如:/login", "参数如:channelId=1&index=1");
文件下载方式没有封装在http->postData 下面即为下载文件代码
参考了
https://stackoverflow.com/questions/1011339/how-do-you-make-a-http-request-with-c
http://blog.csdn.net/liukang325/article/details/52538256
期间遇到的坑
1.传ip的时候需要在本地hosts文件中加映射 如 ip 域名
2.中文具有编码问题,需要转换,已加在源码中
源码下载
http://download.csdn.net/download/loyal_to/10249244