Hello All,
I am trying to make a simple GUI which allows me to send a simple HTTPS URL with parameters under the form of https://herp.derp.com/sms/sendtxt.php?username=this&password=that&number=012 3456789&message=Lolhai&sender=MrCloud
I've confirmed that using the above URL in Firefox sends my txt through, so it's my GUI that's failing.
I've tried QHttp and I've tried QNetworkAccessManager, but to no avail. I feel like I'm missing something really trivial, so after googling relentlessly for two days without finding the answer, I feel like I need to ask a question specific to my project.
This is the code I've been trying to get to work:
void hcode::pbSendClicked(){
QNetworkAccessManager *nwam = new QNetworkAccessManager();
QNetworkRequest request
(QUrl("https://herp.derp.com/sms/sendtxt.php"));
params.addQueryItem("username", ui->le1U->text());
params.addQueryItem("password", ui->le2P->text());
params.addQueryItem("mobilenumber", ui->le4N->text());
params.addQueryItem("message", ui->teText->toPlainText());
params.addQueryItem("sender", ui->le3S->text());
params.addQueryItem("messagetype", "Text" );
data=params.encodedQuery();
nwam->post(request,data);
}
void hcode::pbSendClicked(){
QNetworkAccessManager *nwam = new QNetworkAccessManager();
QNetworkRequest request(QUrl("https://herp.derp.com/sms/sendtxt.php"));
QByteArray data;
QUrl params;
params.addQueryItem("username", ui->le1U->text());
params.addQueryItem("password", ui->le2P->text());
params.addQueryItem("mobilenumber", ui->le4N->text());
params.addQueryItem("message", ui->teText->toPlainText());
params.addQueryItem("sender", ui->le3S->text());
params.addQueryItem("messagetype", "Text" );
data=params.encodedQuery();
nwam->post(request,data);
}
To copy to clipboard, switch view to plain text mode
Everything the URL needs is queried from lineEdits and textEdits.
What am I missing?
Thanks in advance.
Regards,
Mr_Cloud
Bookmarks