Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved]How to call a PHP script on localhost using Qt?
I am developing an app which broadly does the following:
- Accepts from the user an html file
- Runs a php script to make changes to the html
- Returns the changed html back to the user to view
How can I call the PHP script in Qt? I am using Apache running on my localhost
goetz last edited by
I would call the PHP command line tool. See the "wiki article":http://developer.qt.nokia.com/wiki/Call_an_AppleScript_from_Qt for an example. It calls the applescript interpreter on OS X, but it's basically the same for the PHP command line tool.
dialingo last edited by
You can use QNetworkAccessManager to access a page on localhost to trigger the included PHP script. See the documentation of QNetworkAccessManager how you can do this.
Thanks. I will try these and post back the progress
2beers last edited by
you make a http request to your localhost http server(in your case apache server)
more info you can find here: "Qt http request":http://wiki.forum.nokia.com/index.php/CS001431_-_Creating_an_HTTP_network_request_in_Qt
for example you have the following php pahe in your htdocs directory: test.php
Thanks. Using QNetworkAccessManager and QNetworkReply answered the requirement.