CurlHttp.h 602 B

1234567891011121314151617181920212223242526272829
  1. #ifndef CURLHTTP_H
  2. #define CURLHTTP_H
  3. #include <string>
  4. #include <vector>
  5. #include "curl/curl.h"
  6. class CurlHttp
  7. {
  8. public:
  9. CurlHttp();
  10. ~CurlHttp();
  11. /* 获取信息 */
  12. static bool Get(const std::string& url, std::string& response);
  13. /* 发送信息 */
  14. static bool Post(const std::string& url, const std::string& postData, std::string& response);
  15. /* 发送带有Http头和包体的信息 */
  16. static bool PostWithBody(const std::string& url, const std::vector<std::string>& vecHeader, const std::string& postData, std::string& response);
  17. };
  18. #endif /* CURLHTTP_H */