Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkManger get() post() example
Qt 6.11 is out! See what's new in the release blog

QNetworkManger get() post() example

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arno
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      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.1

      Question 2. Yes
      @
      const QRegExp re(",([1-9]),"); // Qt4 or Qt5. QRegularExpression also usable on Qt5
      qDebug() << NoHTML.replace(re, ",0\1,");
      @

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Arno
        wrote on last edited by
        #3

        Hi ChrisW67.
        Thank you, works fine.

        Arn

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved