#pragma once
/*
 * CommonTools.h
 *
 *  Created on: 2018��8��2��
 *      Author: tom
 */
#include <iostream>
#include <curl.h>
#include <vector>
#include <string>
#include <sstream>

using namespace std;

class CommonTools {
public:
    CommonTools();
    ~CommonTools();
public:
    static size_t receive_data(void* contents, size_t size, size_t nmemb, void* stream);
    // HTTP �����ļ��Ļص�����
    static size_t writedata2file(void* ptr, size_t size, size_t nmemb, FILE* stream);
    // �ļ����ؽӿ�
    static int download_file(const char* url, const char outfilename[FILENAME_MAX]);
    // �ļ��ϴ�
    static int upload_file(const char* url, const char* fileName, string& response);
    // http get ����
    static CURLcode HttpGet(const std::string& strUrl, std::string& strResponse, int nTimeout);
    // htpp post ����
    static CURLcode HttpPost(const std::string& strUrl, std::string szJson, std::string& strResponse, int nTimeout);
    // htpp put ����
    static CURLcode HttpPut(const std::string& strUrl, std::string szJson, std::string& strResponse, int nTimeout);
    static CURLcode HttpDelete(const std::string& strUrl, std::string& strResponse, int nTimeout);
    static int upload_file1(const char* url, const char* fileName1, const char* fileName2, const char* fileName3,vector<string>& res, string& response);
};