[SOLVED] Params in URL with QNetworkAccessManager
-
@ QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QUrl url("http://localhost/request.php"); QNetworkRequest request(url); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); QUrl params; params.addQueryItem("n", "friend"); manager->post(request, params.encodedQuery());@
Not passing the parameter "n" including the site gives an error accusing that.
PHP:
@Notice: Undefined index: n in C:\wamp\www\request.php on line 3@ -
Are you using POST or GET in your php script?
-
$_GET
-
If I understood documentation correctly, you're posting data in a request header (POST), and not setting it in URL, from where $_GET reads it.
Try reading from post ($_POST).