V
V
VirusesAnalystCoder2020-06-22 22:44:25
C++ / C#
VirusesAnalystCoder, 2020-06-22 22:44:25

How to get messages via api.telegram.org in C++?

Hello.
In general, I'm making a bot in C++.
Everything is almost ready. Made a class on WinInet which sends requests. But at one point I stopped.
The thing is, I'm using the nlohmann json library for mingw.
And when I parse getUpdates, then my program just crashes. How to properly parse getUpdates with nlohmann mingw?
The code:

Sleep(1000);
        HttpRequests http("api.telegram.org");
        string page = http.WstringToString(http.SendInetRequest(P_HTTPS, M_GET, L"/bot***/getUpdates" L""));
        MessageBox(NULL, page.c_str(), "", MB_OK);
        json mid = json::parse(page);
        lastmes = mid["result"]["message"]["text"];
        MessageBox(NULL,  lastmes.c_str(), "123", MB_OK);

        InternetSetOption(0, 42, NULL, 0);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question