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. QNetworkaccessmanager - post
Qt 6.11 is out! See what's new in the release blog

QNetworkaccessmanager - post

Scheduled Pinned Locked Moved General and Desktop
21 Posts 4 Posters 11.9k 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.
  • T Offline
    T Offline
    toho71
    wrote on last edited by
    #3

    I didn't get that either to work properly.
    Do you have an example of that

    1 Reply Last reply
    0
    • T Offline
      T Offline
      toho71
      wrote on last edited by
      #4

      I even got this in the debugwindow

      bq. X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 15 (X_QueryTree)
      Resource id: 0x165b0ef
      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 40 (X_TranslateCoords)
      Resource id: 0x165b0ef
      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 15 (X_QueryTree)
      Resource id: 0x165c579
      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 40 (X_TranslateCoords)
      Resource id: 0x165c579
      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 15 (X_QueryTree)
      Resource id: 0x165e494
      X Error: BadWindow (invalid Window parameter) 3
      Major opcode: 40 (X_TranslateCoords)
      Resource id: 0x165e494

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fluca1978
        wrote on last edited by
        #5

        In your (truncated) for cycle you are assigning the same parameter multiple times. Is that what you really want to achieve? I believe you want to concat the values into a single variable.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          toho71
          wrote on last edited by
          #6

          i want to post
          postData.append("m_iFuelSensor=") ;// Value
          as a list to the server.

          it could be one or many values
          not as a singel variabel;

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fluca1978
            wrote on last edited by
            #7

            @ QByteArray postData;
            postData.append("m_iFuelSensor=");
            for (int i = 0; i < selectedToAck.size(); ++i)
            postData.append(model->item(index.row(),0)->data(Qt::DisplayRole).toString());
            @

            1 Reply Last reply
            0
            • T Offline
              T Offline
              toho71
              wrote on last edited by
              #8

              No "?" ?
              Because now all the values are in the variabel and its gonna be a big number.
              Shouldn't i have some sort of delimiter maybe

              1 Reply Last reply
              0
              • T Offline
                T Offline
                toho71
                wrote on last edited by
                #9

                More errors
                I got the errorcode 302 unknown error when i do my post but it changes the value in the textbox.
                if I send one value.
                When i changed to get operation I got the errorcode 200 "OK"
                If someone have a simple example to show or some great hints to get me go on with this "Problem"
                I would be very happy.

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fluca1978
                  wrote on last edited by
                  #10

                  [quote author="toho71" date="1324472734"]No "?" ?
                  Because now all the values are in the variabel and its gonna be a big number.
                  Shouldn't i have some sort of delimiter maybe[/quote]

                  You are right, at each iteration you have to add a delimiter.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    toho71
                    wrote on last edited by
                    #11

                    Ok thank you but it still doesn't work as i expected.
                    Same problems and no update of the webpage.
                    Maybe I have to do it in another way becaus when I use ex. Wireshark I dont see the incoming values in my postoperation.
                    Strange.

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      fluca1978
                      wrote on last edited by
                      #12

                      What if you try to make a GET request? Just to see if the data is sent or not.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        toho71
                        wrote on last edited by
                        #13

                        I got the errorcode 302 unknown error when i do my post but it changes the value in the textbox when i update the webpage and if I send one value?

                        When i changed to get operation I got the errorcode 200 == “OK”

                        1 Reply Last reply
                        0
                        • F Offline
                          F Offline
                          fluca1978
                          wrote on last edited by
                          #14

                          I would start doing a post request with another tool, let say wget, and see how the request must be done and then reproduce it in Qt.

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            toho71
                            wrote on last edited by
                            #15

                            This can't be a problem in qt but I don't know how to do it properly.

                            It must be someone else who have done this before.

                            Maybe I have to use Qhttp instead

                            1 Reply Last reply
                            0
                            • G Offline
                              G Offline
                              goetz
                              wrote on last edited by
                              #16

                              [quote author="toho71" date="1324560334"
                              Maybe I have to use Qhttp instead
                              [/quote]

                              You will run into the very same problems with constructing the URL and/or preparing the post data. You will need to understand HTTP protocol basics before using it in a class.

                              http://www.catb.org/~esr/faqs/smart-questions.html

                              1 Reply Last reply
                              0
                              • T Offline
                                T Offline
                                toho71
                                wrote on last edited by
                                #17

                                I'm sorry but after reading more about this subject I'm still not able to go further so If some nice person would tell me a little more how to take the next step so I got this code working with Post request it would be great.

                                1 Reply Last reply
                                0
                                • F Offline
                                  F Offline
                                  fluca1978
                                  wrote on last edited by
                                  #18

                                  Do you have the exact list of parameters as they have to be sent to the server to perform a correct post request? How is your code working now and what is the exact problem?

                                  1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    toho71
                                    wrote on last edited by
                                    #19

                                    I have a list in a table and when I check (Chkbox) some rows in that table I got a list of numbers that I want to post to a list on the server. It works with one value when I refresh the browserwindow but not with more values.

                                    //T

                                    1 Reply Last reply
                                    0
                                    • F Offline
                                      F Offline
                                      fluca1978
                                      wrote on last edited by
                                      #20

                                      I suspect your cgi/web application does not allow you to set multiple values at once, or has a special formatting for such values. Do you have the specifics of the parameters your web application is accepting? Otherwise you have to guess and try.

                                      1 Reply Last reply
                                      0
                                      • T Offline
                                        T Offline
                                        toho71
                                        wrote on last edited by
                                        #21

                                        Ok thank you for the tip.

                                        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