[Solved]How to call a PHP script on localhost using Qt?
-
Hello,
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
-
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.
-
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_Qtfor example you have the following php pahe in your htdocs directory: test.php
@// test.php
echo("hello world");
@you just access your page : http://localhost/test.php
@QUrl url("http://localhost/test.php");
QNetworkReply* reply = nam->get(QNetworkRequest(url));@