Created
May 23, 2015 15:52
-
-
Save v-kolesnikov/cd6a8e93d62be5b2e7be to your computer and use it in GitHub Desktop.
SimpleRequest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QCoreApplication> | |
#include <QNetworkAccessManager> | |
#include <QNetworkRequest> | |
#include <QNetworkReply> | |
#include <QUrl> | |
#include <QDebug> | |
int main(int argc, char *argv[]) | |
{ | |
QCoreApplication a(argc, argv); | |
QUrl url("http://surfer.96.lt/out.php"); | |
QNetworkAccessManager *nam = new QNetworkAccessManager; | |
QNetworkRequest request(url); | |
QNetworkReply *reply = nam->get(request); | |
QObject::connect(reply, &QNetworkReply::finished, [reply]() { | |
qDebug() << "\nReply:"; | |
for (auto header : reply->rawHeaderPairs()) { | |
qDebug() << header.first << ":" << header.second; | |
} | |
qDebug() << reply->readAll(); | |
reply->deleteLater(); | |
qApp->quit(); | |
}); | |
return a.exec(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------- | |
# | |
# Project created by QtCreator 2015-05-23T18:26:20 | |
# | |
#------------------------------------------------- | |
QT += core network | |
QT -= gui | |
CONFIG += c++11 | |
TARGET = SimpleRequest | |
CONFIG += console | |
CONFIG -= app_bundle | |
TEMPLATE = app | |
SOURCES += main.cpp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment