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. How to contact a server url and retrieve the answer is a string
Forum Updated to NodeBB v4.3 + New Features

How to contact a server url and retrieve the answer is a string

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 1.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.
  • S Offline
    S Offline
    SamFaye
    wrote on last edited by
    #1

    I want to contact a server via http and it returns me a string

    How can I do that?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gedd
      wrote on last edited by
      #2

      Firefox, IE, Chrome & Safari
      Or you can try to search http in Qassistant --> QHttp

      Gedd

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SamFaye
        wrote on last edited by
        #3

        I want to take a url like http://nom_machine/pppp.php?code1=valeur1&code2=valeur2
        Once I do that I receive a page with content true or false. That's what I want to get content.

        And if I do this:
        @QNetworkAccessManager manager (this);

        QNetworkRequest request ("http://nom_machine/pppp.php?code1=valeur1&code2=valeur2");
        QNetworkReply * reply = manager.get (request);

        reply-> readAll ();@

        Will reply-> readAll () returns "true" or "false" value that is displayed on the page?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          Yes but QNAM is asynchronous, so you'll have to use signals/slots (have a look at the examples).

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #5

            Just for the records: QHttp is obsolete. Do not use it in new code - use QNAM instead.

            The code you've posted is a good start. As soon as the request has been finished the finished() signal is emitted and can be used to process the request.

            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