QNetworkManger get() post() example
-
Hi All.
I am new to Qt.
I have 2 questions, please.
1 Question:
I want to put text in an HTML form, in a text box, , this text is a date, simulate the click on a button and post the request.
Have done a search for the topic but no luck.
Somebody could address me to a link on the topic above?
2 Question:
@ NoHTML.replace (",1,", ",01,");
NoHTML.replace (",2,", ",02,");
NoHTML.replace (",3,", ",03,");
NoHTML.replace (",4,", ",04,");
NoHTML.replace (",5,", ",05,");
NoHTML.replace (",6,", ",06,");
NoHTML.replace (",7,", ",07,");
NoHTML.replace (",8,", ",08,");
NoHTML.replace (",9,", ",09,");@The above code could be simplified?
Thanks
Arn
-
Question 1.
See the "HTTP Example" or "Network Download" example in Assistant for HTTP get.
For post() the plumbing is the same as the examples above, but you send a payload with the POST request. The exact format of the payload depends on the target server. For a generic web form you set a content type header of "application/x-www-form-urlencoded" and a payload like "MyVariableOne=ValueOne&MyVariableTwo=ValueTwo" encoded per the specification
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1Question 2. Yes
@
const QRegExp re(",([1-9]),"); // Qt4 or Qt5. QRegularExpression also usable on Qt5
qDebug() << NoHTML.replace(re, ",0\1,");
@ -
Hi ChrisW67.
Thank you, works fine.Arn