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. using internet request Get with qt and "print" the reply

using internet request Get with qt and "print" the reply

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 974 Views 2 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.
  • F Offline
    F Offline
    filipdns
    wrote on last edited by
    #1

    Hello,

    I would like to print on console log the reply from flight radar query using .

    using below in Internet explorer bar
    http://aviation-edge.com/v2/public/flights?key=a51a70-b58f88&depIcao=LFOB

    display:
    [ { "geography": { "latitude": 45.6335, "longitude": 19.3076, "altitude": 10670.7, "direction": 116.9 }, "speed": { "horizontal": 900.511, "isGround": 0, "vertical": 0.32512 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "VNO", "icaoCode": "EYVI" }, "aircraft": { "regNumber": "HALYR", "icaoCode": "A320", "icao24": "", "iataCode": "A320" }, "airline": { "iataCode": "W6", "icaoCode": "WZZ" }, "flight": { "iataNumber": "W6601", "icaoNumber": "WZZ601", "number": "601" }, "system": { "updated": "1542990359", "squawk": "1140" }, "status": "en-route" }, { "geography": { "latitude": 43.149, "longitude": 12.468, "altitude": 11280.5, "direction": 170.4 }, "speed": { "horizontal": 805.185, "isGround": 0, "vertical": 0 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "VNO", "icaoCode": "EYVI" }, "aircraft": { "regNumber": "EIDAJ", "icaoCode": "B738", "icao24": "", "iataCode": "B738" }, "airline": { "iataCode": "FR", "icaoCode": "RYR" }, "flight": { "iataNumber": "FR9MV", "icaoNumber": "RYR9MV", "number": "9MV" }, "system": { "updated": "1542990292", "squawk": "224" }, "status": "en-route" }, { "geography": { "latitude": 37.881, "longitude": -5.48691, "altitude": 11280.5, "direction": 96 }, "speed": { "horizontal": 760.761, "isGround": 1, "vertical": -4.8768 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "TNG", "icaoCode": "GMTT" }, "aircraft": { "regNumber": "EIDLH", "icaoCode": "B738", "icao24": "4CA2D4", "iataCode": "B738" }, "airline": { "iataCode": "FR", "icaoCode": "RYR" }, "flight": { "iataNumber": "FR7744", "icaoNumber": "RYR7744", "number": "7744" }, "system": { "updated": "1542990242", "squawk": "7635" }, "status": "en-route" }, { "geography": { "latitude": 42.1267, "longitude": 10.5674, "altitude": 11280.5, "direction": 158.5 }, "speed": { "horizontal": 806.296, "isGround": 0, "vertical": 0 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "CIA", "icaoCode": "LIRA" }, "aircraft": { "regNumber": "EIDWA", "icaoCode": "B738", "icao24": "", "iataCode": "B738" }, "airline": { "iataCode": "FR", "icaoCode": "RYR" }, "flight": { "iataNumber": "FR5DN", "icaoNumber": "RYR5DN", "number": "5DN" }, "system": { "updated": "1542990241", "squawk": "1164" }, "status": "en-route" } ]

    I would like to have qDebug() print me the same on console log.

    what can I use in qt to do that?

    Thank you very much for your help

    Kind regards

    Phil

    K 1 Reply Last reply
    0
    • F filipdns

      Hello,

      I would like to print on console log the reply from flight radar query using .

      using below in Internet explorer bar
      http://aviation-edge.com/v2/public/flights?key=a51a70-b58f88&depIcao=LFOB

      display:
      [ { "geography": { "latitude": 45.6335, "longitude": 19.3076, "altitude": 10670.7, "direction": 116.9 }, "speed": { "horizontal": 900.511, "isGround": 0, "vertical": 0.32512 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "VNO", "icaoCode": "EYVI" }, "aircraft": { "regNumber": "HALYR", "icaoCode": "A320", "icao24": "", "iataCode": "A320" }, "airline": { "iataCode": "W6", "icaoCode": "WZZ" }, "flight": { "iataNumber": "W6601", "icaoNumber": "WZZ601", "number": "601" }, "system": { "updated": "1542990359", "squawk": "1140" }, "status": "en-route" }, { "geography": { "latitude": 43.149, "longitude": 12.468, "altitude": 11280.5, "direction": 170.4 }, "speed": { "horizontal": 805.185, "isGround": 0, "vertical": 0 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "VNO", "icaoCode": "EYVI" }, "aircraft": { "regNumber": "EIDAJ", "icaoCode": "B738", "icao24": "", "iataCode": "B738" }, "airline": { "iataCode": "FR", "icaoCode": "RYR" }, "flight": { "iataNumber": "FR9MV", "icaoNumber": "RYR9MV", "number": "9MV" }, "system": { "updated": "1542990292", "squawk": "224" }, "status": "en-route" }, { "geography": { "latitude": 37.881, "longitude": -5.48691, "altitude": 11280.5, "direction": 96 }, "speed": { "horizontal": 760.761, "isGround": 1, "vertical": -4.8768 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "TNG", "icaoCode": "GMTT" }, "aircraft": { "regNumber": "EIDLH", "icaoCode": "B738", "icao24": "4CA2D4", "iataCode": "B738" }, "airline": { "iataCode": "FR", "icaoCode": "RYR" }, "flight": { "iataNumber": "FR7744", "icaoNumber": "RYR7744", "number": "7744" }, "system": { "updated": "1542990242", "squawk": "7635" }, "status": "en-route" }, { "geography": { "latitude": 42.1267, "longitude": 10.5674, "altitude": 11280.5, "direction": 158.5 }, "speed": { "horizontal": 806.296, "isGround": 0, "vertical": 0 }, "departure": { "iataCode": "BVA", "icaoCode": "LFOB" }, "arrival": { "iataCode": "CIA", "icaoCode": "LIRA" }, "aircraft": { "regNumber": "EIDWA", "icaoCode": "B738", "icao24": "", "iataCode": "B738" }, "airline": { "iataCode": "FR", "icaoCode": "RYR" }, "flight": { "iataNumber": "FR5DN", "icaoNumber": "RYR5DN", "number": "5DN" }, "system": { "updated": "1542990241", "squawk": "1164" }, "status": "en-route" } ]

      I would like to have qDebug() print me the same on console log.

      what can I use in qt to do that?

      Thank you very much for your help

      Kind regards

      Phil

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @filipdns

      Looks like JSON

      Vote the answer(s) that helped you to solve your issue(s)

      F 1 Reply Last reply
      1
      • K koahnig

        @filipdns

        Looks like JSON

        F Offline
        F Offline
        filipdns
        wrote on last edited by
        #3

        @koahnig thank you, but do you how qt can make network request? I try to understand the QNetworkAccessManager Class not without success

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          What is the issue u have with networkaccessmanager ? You can do the above only with networkaccessmanager

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          F 1 Reply Last reply
          2
          • dheerendraD dheerendra

            What is the issue u have with networkaccessmanager ? You can do the above only with networkaccessmanager

            F Offline
            F Offline
            filipdns
            wrote on last edited by filipdns
            #5

            @dheerendra Hello, I have no issue, I just do not understand how to use it.

            In Qt sample they use :

                QNetworkAccessManager *manager = new QNetworkAccessManager(this);
                connect(manager, SIGNAL(finished(QNetworkReply*)),
                        this, SLOT(replyFinished(QNetworkReply*)));
                
                manager->get(QNetworkRequest(QUrl("http://aviation-edge.com/v2/public/flights?key=a51a70-b58f88&depIcao=LFOB")));
            

            but I received message: invalid use of 'this' outside of a non-static member function

            I may be forgot to say, I'm new in c++ ... ;-)

            K 1 Reply Last reply
            0
            • F filipdns

              @dheerendra Hello, I have no issue, I just do not understand how to use it.

              In Qt sample they use :

                  QNetworkAccessManager *manager = new QNetworkAccessManager(this);
                  connect(manager, SIGNAL(finished(QNetworkReply*)),
                          this, SLOT(replyFinished(QNetworkReply*)));
                  
                  manager->get(QNetworkRequest(QUrl("http://aviation-edge.com/v2/public/flights?key=a51a70-b58f88&depIcao=LFOB")));
              

              but I received message: invalid use of 'this' outside of a non-static member function

              I may be forgot to say, I'm new in c++ ... ;-)

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              @filipdns

              Here are the Network examples use them and change them for your trials e.g. this example

              You need to show more code around your snippet.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              3

              • Login

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