I am pretty new with this. I am trying to develop some android application in Qt/Qml to query and update data to a database.
The problem I'm trying to solve:
There is a server with a MySQL database. The android application request some data. I use a very very basic php file that query in the database, format an XML and show that file starting with a header('Content-type: text/xml');
sentence, then some echo "<...>"
sentences. This php file receives parameters via $_GET
array and performs the query.
This is a little archaic but works fine. My client application use Qt/QML for android. It uses XmlListModel
to obtain the data from the server and show that data in a ListView
.
So far so good, but here is my real problem:
The user of the android application can change some data, and the modified data must be sent back to the server, who performs an update in the database.
My first attempt was to create another php file and send the data in the URI, get it via $_GET
and perform the update to the database. This works but there could be many variables and the URI will become very large. I think might be better to send an XML (or JSON) from the client to the server, and put in that file the data for the update.
So, this is the question: How can I send an XML file from Qt/QML to the server? How does the php file obtain that data? Or maybe there is another, better way for doing this.
Every example I find just shows the server-to-client part, or is written in Java, and I don't know java enough.
Additional notes:
- After I can solve this I will fight with security: SSL, avoiding SQL injection or anything, but that will be in another question if necessary.
- I didn't use SOAP or similar because the first ideas was simple. Also, I have never used SOAP before. If this is the right way, I would be very grateful if you show me how to use it from Qt/QML in android.
- Of course, I can use C++ for the client application since it is using Qt.
- I use Qt since I already know it and the app might be useful in desktop as well.
Sorry if I made any english mistake. Thank you in advance.