This is how my QT application calls the PHP script; QUrlurl("*****.com/ id.php");QNetworkRequestrequest(url);request.setHeader(QNetworkRequest::ContentTypeHeader,"appl"> How to solve the "Notice: Undefined index" error when QT application calls php script-PHP Chinese Network Q&A
How to solve the "Notice: Undefined index" error when QT application calls php script
P粉293341969
P粉293341969 2023-09-04 20:26:40
0
1
453

This is my 1 line of PHP code;

This is how my QT application calls the PHP script;

QUrl url("http://*****.com/id.php"); QNetworkRequest request(url); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); QUrlQuery params; params.addQueryItem("api", "test"); networkClients->post(request, params.query().toUtf8());

This is a PHP notification

The code ran seamlessly on my previous hosting provider. After I moved my stuff to hostinger, I am now unable to send data to my application using POST requests ($_POST['api'] returns empty and echo does not output anything). GET requests work fine. I also tested on reqbin and it works fine, but the application doesn't.

P粉293341969
P粉293341969

reply all (1)
P粉466290133

QUrlQuerywill add parameters to the URL. This means they must be received using theGETmethod.

However, it is always recommended to check if the value is null.

ThePOSTmethod can only be used when submitting or posting the form using a form and a button or an input of type button.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!