using internet request Get with qt and "print" the reply
-
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=LFOBdisplay:
[ { "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
-
What is the issue u have with networkaccessmanager ? You can do the above only with networkaccessmanager
-
@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++ ... ;-)
-
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.