CMyHttpClient.h 836 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include <afxinet.h>
  3. #include <string>
  4. #include <vector>
  5. #include <boost\smart_ptr.hpp>
  6. using namespace std;
  7. #define IE_AGENT _T("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)")
  8. class __declspec(dllexport) CMyHttpClient
  9. {
  10. public:
  11. enum { SUCCESS = 0, FAILURE = 1, OUTTIME = 2 };
  12. public:
  13. CMyHttpClient(LPCTSTR strAgent = IE_AGENT);
  14. virtual ~CMyHttpClient(void);
  15. //int HttpPostFile(LPCTSTR strUrl, std::vector<CInputFiled*>& inputs, string &strResponse);
  16. int HttpDownload(LPCTSTR url, LPCTSTR post_data, std::vector<char> &data);
  17. static boost::shared_ptr<CMyHttpClient> GetInstance();
  18. private:
  19. void Clear();
  20. private:
  21. CInternetSession *m_pSession;
  22. CHttpConnection *m_pConnection;
  23. CHttpFile *m_pHttpFile;
  24. public:
  25. int SetSendHeader(CString send);
  26. private:
  27. CString MySendHeader;
  28. };