QNetworkAccessManager networkManager;
QNetworkRequest request;
QString requestUrl
= "www.google.at";
arr.append(requestData);
request.
setHeader(QNetworkRequest
::ContentTypeHeader,
QVariant( QString("text/xml;charset=UTF-8")));
request.
setHeader(QNetworkRequest
::ContentLengthHeader,
QVariant( qulonglong
(arr.
size()) ));
request.
setAttribute(QNetworkRequest
::CacheLoadControlAttribute,
QVariant( int(QNetworkRequest
::AlwaysNetwork) ));
request.
setUrl(QUrl(requestUrl
));
QObject::connect(networkManager,
SIGNAL(finished
(QNetworkReply
*)),
this,
SLOT(onRequestFinished
(QNetworkReply
*)));
QObject::connect(networkManager,
SIGNAL(authenticationRequired
(QNetworkReply
*,QAuthenticator
*)),
this,
SLOT(onAuthenticationRequired
(QNetworkReply
*, QAuthenticator
*)));
networkReply = networkManager.post(request, arr);
QObject::connect(this,
SIGNAL(sigCancelRequest
()), networkReply,
SLOT(abort()));
QNetworkAccessManager networkManager;
QNetworkRequest request;
QByteArray arr;
QString requestData = "";
QString requestUrl= "www.google.at";
arr.append(requestData);
request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant( QString("text/xml;charset=UTF-8")));
request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant( qulonglong(arr.size()) ));
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QVariant( int(QNetworkRequest::AlwaysNetwork) ));
request.setUrl(QUrl(requestUrl));
QObject::connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onRequestFinished(QNetworkReply*)));
QObject::connect(networkManager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(onAuthenticationRequired(QNetworkReply*, QAuthenticator*)));
networkReply = networkManager.post(request, arr);
QObject::connect(this, SIGNAL(sigCancelRequest()), networkReply, SLOT(abort()));
To copy to clipboard, switch view to plain text mode
Bookmarks