summaryrefslogtreecommitdiff
path: root/src/Api.cpp
diff options
context:
space:
mode:
authorNaveen <naveen.sanmane@gmail.com>2015-11-23 10:08:38 +0000
committerNaveen <naveen.sanmane@gmail.com>2015-11-23 10:08:38 +0000
commite05c5ca197d7ccac7ea20db78c1e101090ff629a (patch)
tree11a4c12b3e2b2755e49583d80e6678ad7309301f /src/Api.cpp
parent3040a62a71050e53624583bd83b3bffeb6aca9f0 (diff)
Add Chat class
Diffstat (limited to 'src/Api.cpp')
-rw-r--r--src/Api.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 9c8259f..2e3af45 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -256,14 +256,20 @@ void Api::setWebhook(const string& url) const {
}
ptree Api::sendRequest(const string& method, const vector<HttpReqArg>& args) const {
+
string url = "https://api.telegram.org/bot";
url += _token;
url += "/";
url += method;
+
+ std::cout << "URL: " << url << std::endl;
string serverResponse = HttpClient::getInstance().makeRequest(url, args);
if (serverResponse.find("<html>") != serverResponse.npos) {
throw TgException("tgbot-cpp library have got html page instead of json response. Maybe you entered wrong bot token.");
}
+
+ std::cout << "Server Response: " << serverResponse << std::endl;
+
ptree result = TgTypeParser::getInstance().parseJson(serverResponse);
try {
if (result.get<bool>("ok", false)) {