You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#define CPPHTTPLIB_OPENSSL_SUPPORT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <codecvt>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <httplib.h>
|
|
|
|
|
#include <json.hpp>
|
|
|
|
|
using json = nlohmann::json;
|
|
|
|
|
using namespace std;
|
|
|
|
|
int main(void) {
|
|
|
|
|
|
|
|
|
|
httplib::Client cli("https://121.36.33.250:9000");
|
|
|
|
|
cli.enable_server_certificate_verification(false);
|
|
|
|
|
|
|
|
|
|
json j = {{"fanId",1055}};
|
|
|
|
|
std::string body = j.dump();
|
|
|
|
|
|
|
|
|
|
httplib::Headers headers = {{"GroupId", "dam"}};
|
|
|
|
|
|
|
|
|
|
if (auto res = cli.Post("/services/application/api/fan_app/gyroDetail", headers, body, "application/json")) {
|
|
|
|
|
cout << res->status << endl;
|
|
|
|
|
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
|
|
|
|
std::wstring wstr =
|
|
|
|
|
converter.from_bytes(res->body); // <20><>char<61><72><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
std::wcout.imbue(
|
|
|
|
|
std::locale("chs")); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>Ϊ<EFBFBD><CEAA><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
|
|
|
|
|
wcout << wstr << endl;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cout << "error code: " << res.error() << std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|