QString dns = "http://hst-api.wialon.com/wialon/ajax.html";QString token = "117b6de8b8560a1b2d078c92fca6bafaDE5A417A7E5168A59F6A1E342ED652867633B3C";QString request = dns + "?svc=token/login¶ms={\"token\":\"" + token + "\"}";QNetworkAccessManager *manager = new QNetworkAccessManager(this);connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(slotReplyFinished(QNetworkReply*)));manager->get(QNetworkRequest(QUrl(request)));
void CMainWindow::slotReplyFinished(QNetworkReply* reply){ qDebug() << reply->errorString(); qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();}
C++ (Qt)QNetworkRequest netRequest(QUrl(request));netRequest.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));manager->get(netRequest);
C++ (Qt) QString dns = "http://hst-api.wialon.com/wialon/ajax.html"; QString token = "117b6de8b8560a1b2d078c92fca6bafaDE5A417A7E5168A59F6A1E342ED652867633B3C"; QString request = dns + "?svc=token/login¶ms={\"token\":\"" + token + "\"}"; QNetworkAccessManager *manager = new QNetworkAccessManager; QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(request))); QEventLoop loop; QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); qDebug() << reply->readAll();
C++ (Qt) QString dns = "http://hst-api.wialon.com/wialon/ajax.html"; QString token = "905b6be8b8560a1b2d078c92fca6bafaDE417407A7E5168A59F6A1E342ED652867679A3B"; QString request = dns + "?svc=token%2Flogin¶ms={\"token\":\"" + token + "\"}"; QNetworkAccessManager *manager = new QNetworkAccessManager; QNetworkReply *reply = manager->get(QNetworkRequest(request)); QEventLoop loop; QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); loop.exec(); qDebug() << reply->readAll().length();