CurlHttp.h 759 B

12345678910111213141516171819202122232425262728293031
  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. /* 获取信息,带有http头 */
  14. static bool Get(const std::string& url, const std::vector<std::string>& vecHeader, std::string& response);
  15. /* 发送信息,带有包体 */
  16. static bool Post(const std::string& url, const std::string& postData, std::string& response);
  17. /* 发送带有Http头和包体的信息 */
  18. static bool Post(const std::string& url, const std::vector<std::string>& vecHeader, const std::string& postData, std::string& response);
  19. };
  20. #endif /* CURLHTTP_H */