// *************************************************************************** void CHttpPostTask::run(void) { CHttpClient httpClient; std::string ret; if ( ! httpClient.connect(_Host)) { return; } if ( ! httpClient.sendPost(_Host + _Page, _Params)) { return; } httpClient.receive(ret); httpClient.disconnect(); }
//============================================================================================ std::string sendMsg(const std::string &msg) { CHttpClient httpClient; std::string ret; if (!httpClient.connect("http://" + StartupHost)) { throw NLMISC::Exception("Can't connect to http server"); } //std::string postString = "http://" + StartupHost + StartupPage + "?cmd=log&msg=" + msg; //nlwarning("POST STRING = %s", postString.c_str()); if (!httpClient.sendPost("http://" + StartupHost + StartupPage, "cmd=log&msg=" + msg)) { throw NLMISC::Exception("Post failed"); } if (!httpClient.receive(ret)) { throw NLMISC::Exception("Receive failed"); } httpClient.disconnect(); return ret; }