-
Notifications
You must be signed in to change notification settings - Fork 0
/
qfetionnetwork.cpp
43 lines (31 loc) · 1.09 KB
/
qfetionnetwork.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "qfetionnetwork.h"
QFetionNetwork::QFetionNetwork(QDeclarativeItem *parent) :
QDeclarativeItem(parent)
{
nwam = new QNetworkAccessManager(this);
request= QNetworkRequest(QUrl("http://166.111.73.2/~cuckoo/sms/sendsms.php"));
connect(nwam,SIGNAL(finished(QNetworkReply*)),this,SLOT(finished(QNetworkReply*)));
}
void QFetionNetwork::sendSMS(QString sender,QString password,QString sendto,QString message)
{
QByteArray data;
QUrl params;
params.addQueryItem("cellphone", sender );
params.addQueryItem("password", password );
params.addQueryItem("sendto",sendto);
params.addQueryItem("message",message.toUtf8());
data.append(params.toString());
data.remove(0,1);
nwam->post(request,data);
}
void QFetionNetwork::finished ( QNetworkReply * reply ){
if(reply->error() == QNetworkReply::NoError)
{
QByteArray replyinfo = reply->readAll();
if (replyinfo == "Success")
qDebug() <<"SendSMS Success";
else
qDebug() << "SendSMS Error";
}else
qDebug("SendSMS Error detected!\n");
}