The first Contact QT HTTP project, today looked at the post and get basic use method, began to try. Originally thought that post is dedicated to sending requests to the server, and then receiving the server answer, and get is simply to get the resources from the server, such as downloading this page, to obtain the resources stored on the Web page. But when it comes to projects, the results of the tests are a testament to my innocence and misunderstanding.
In fact, both post and get are used to send requests to the server, both of which can take parameters, but in a slightly different way. The difference is that get integrates parameters directly with the URL as a whole, while post splits it into two parts, one part is the URL, the other is the parameter, and the message SetHeader must be set, otherwise the server cannot find the parameter. The so-called acquisition of resources or the receiving server answer, is not implemented by them, but by the qnetworkrequest to Qnetworkaccessmanager send a request, The answer is received by qnetworkreply from Qnetworkaccessmanager, and finally by Qnetworkaccessmanager interacting with the server. It can be said that post and get are two kinds of request, their operation will trigger the qnetworkaccessmanager/qnetworkrequest/qnetworkreply of the formation of the HTTP network mechanism, or the method depends on the mechanism. PS: The above comments are purely personal opinions, if there are errors, please leave a message. For a detailed distinction between get and Post, refer to Csdn's article: http://blog.csdn.net/lslxdx/article/details/7485297
The article is somewhat old, uses is already has been eliminated by the Qt5 Qhttp class, but still has the very big reference significance, is worth a look. http://blog.csdn.net/jan5_reyn/article/details/38955715
QT Insights: The difference between post and get (get combines parameters directly with the URL as a whole, while post splits it into two parts)