我想将一些信息发布到 php 并从该 php 获取结果。我的 POST 应该如下所示: www.sample.com/test.php?un=user&pass=123345 我正在尝试所有变体但均未成功:
m_NetworkAccessMNGR = new QNetworkAccessManager(this);
connect(m_NetworkAccessMNGR, SIGNAL(finished(QNetworkReply*)),
this,SLOT(slotFinishRequest(QNetworkReply*)));
QNetworkRequest networkRequest;
networkRequest.setUrl(QUrl("http://www.sample.com/test.php?un=user&pass=123345"));
QNetworkReply *reply = m_NetworkAccessMNGR->get(networkRequest);
connect(reply, SIGNAL(readyRead()),
this, SLOT(slotReadyRead()));
connect(reply, SIGNAL(finished()),
this, SLOT(slotOnRequestCompleted()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotOnRequestError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(slotSslErrors(QList<QSslError>)));
代码不执行任何这些插槽。
有人对问题所在有任何想法吗?
谢谢