Important: Please read the Qt Code of Conduct -

PHP request from qt

  • Hi everyone.

    Can anyone please let me know that how to request PHP script from Qt qml and get back the reply to show on the console?

    I had even tried it with ajax but It could not detect the php page as website but normal text.

    Please provide any suggestions.

  • You mean, you need to execute php scriptfile locally or remote but without php webserver?
    You can't do that! PHP is an script and it needs interpreter! You can use php-cli binary to do this locally.
    Something like this:
    QProcess::execute("php-cli", QStringList() << "your-script.php");

  • If the remote server is returning the PHP source code of a PHP page rather than the result of running the PHP then the remote server is incorrectly configured and this is not a Qt problem.

Log in to reply