Post from Qt5

#include <QCoreApplication>
#include <QDebug>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QUrlQuery>
void sendRequest();
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    sendRequest();
    return 0;// a.exec();
}
void sendRequest(){
   QByteArray data;
    QUrlQuery params;
    params.addQueryItem("param1", "value1");
    params.addQueryItem("param2", "value2");
    params.addQueryItem("param3", "value3");
    data.append(params.toString());
    qDebug()<<data;
    QEventLoop eventLoop;
    QNetworkAccessManager manager;
    QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)), &eventLoop, SLOT(quit()));
    QNetworkRequest request(QUrl("http://mars.dev/test"));
    request.setHeader(QNetworkRequest::ContentTypeHeader,QStringLiteral("application/x-www-form-urlencoded"));
    QNetworkReply *reply = manager.post(request,data);
    qDebug()<<"tunggu";
    eventLoop.exec(); // tunggu hingga request finish
    if (reply->error() == QNetworkReply::NoError) {
        //success
        qDebug() << "Success" <<reply->readAll();
        delete reply;
    }
    else {
        //failure
        qDebug() << "Failure" <<reply->errorString();
        delete reply;
    }
    qDebug()<<"selesai";
}