Newbe-question:
In my php project, I’m trying to acces some flight data. Retrieving data is no problem as I can verify by using print_r($result). But I am not able to refer to the data afterwards.
I am trying to convert data to php by using json_decode, and then I get the errormsg: “json_decode() expects parameter 1 to be string”. Then I tried using json_decode($result->content, true) … no errormsg from json, but then I get "Invalid argument supplied for foreach()"
Thanks for your fast reply It is greatly appreciated.
When I try to use the SOAP coding example on the WeatherConditions from your link til Github, it works fine, but when I change the WeatherConditions-part to FlightInfoStatus-part, I still get get " Invalid argument supplied for foreach()"
Example code: foreach ($result->WeatherConditionsResult->conditions as $key => $condition) {
My code: foreach ($result->FlightInfoStatusResults->tailnumber as $key => $tailnumber) {
Perhaps because the FlightInfo-struct is more complex?
Is there a code example on the FlightInfo that works somewhere out there?
The FlightInfoStatusResult will contain an array of flight objects (FlightInfoStatusStruct()) that may contain an optionally present tail value. Printing all the tails in a result may look like this:
foreach($result->FlightInfoStatusResult->flights as $key => $flight) {
print_r($flight->tailnumber);
}