I have the following code and I would like to add some HTTP header information along with the call. Anyway, can I do this?
void NeoAPI::call(QString apiCall) { if (this->ApiCall.contains(apiCall)) { QNetworkAccessManager* manager = new QNetworkAccessManager(0); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(netReplyFinished(QNetworkReply*))); QUrl url = this->ApiCall[apiCall]; url.addQueryItem("memberid","76710"); // Set for backdoor debugging manager->get(QNetworkRequest(url)); } else { this->requestResultText = QString("Call %1 doesn't exist").arg(apiCall); } } void NeoAPI::netReplyFinished(QNetworkReply *netReply) { if (netReply->error() == QNetworkReply::NoError) { this->requestResultText = netReply->readAll(); } else { this->requestResultText = "API Call Failed"; } QMessageBox messageBox; messageBox.setText(this->requestResultText); messageBox.exec(); //delete netReply; }
In addition, if I had not used them inside the class, what would this in connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(netReplyFinished(QNetworkReply*))); to be?
Thanks!
source share