|
|
How to access history in PHP
Last post 06-17-2009, 11:03 AM by agreen. 7 replies.
-
05-28-2009, 7:43 PM |
-
jposkey
-
-
-
Joined on 05-01-2009
-
-
Posts 12
-
-
|
How to access history in PHP
I'm new to PHP, so this is probably more of a PHP question than an FBOweb API question, but here goes.
So I can pull a single flight just fine with this code:
$wsdl_url = 'http://planexml.flightwise.com/ws/PlaneXMLbeta2.asmx?WSDL';
$WSDL = new SOAP_WSDL($wsdl_url,$auth);
$PlaneXML = $WSDL->getProxy();
$flight = $PlaneXML->FlightInfo('VRD900',true,true);
echo $flight->Dest;
So next I wanted to look up FlightHistory, so I tried
$history = $PlaneXML->FlightHistory(ident=='VRD900'&&deptime=='5/18/2009',2);
and
$history = $PlaneXML->FlightHistory("ident=='VRD900'&&deptime=='5/18/2009"',2);
but I'm not succeeding in make any info appear. The following three attempts return nothing:
echo $history->Dest;
echo $history[0]->Ident;
echo $history[1]->Dept;
I tried this:
foreach ($history as $a) {
echo $a;
}
but it returns
GetHistory11024InvalidCharsError processing query; Object reference not set to an instance of an object.Array
And I tried
foreach($history as $key => $value) {
print "$key => $value\n";
}
but it returned
error_message_prefix => GetHistory mode => 1 level => 1024 code => InvalidChars message => Error processing query; Object reference not set to an instance of an object. userinfo => backtrace => Array callback =>
I can't tell if the problem is in my query or in my PHP. Can someone help?
Thanks!
Jeral
|
|
-
05-28-2009, 10:04 PM |
-
agreen
-
-
-
Joined on 04-03-2008
-
-
Posts 51
-
-
|
Re: How to access history in PHP
Hey Jeral! Nope, it's not something wrong with your code, I think. We did uncover a bug with the FlightHistory function which is causing it to not properly interpret the search query strings, and that's what's generating the error you're getting.
However, one note - when you specify a departure time, you should use
depttime>'5/18/2009'
instead of
depttime='5/18/2009'
...because you want the system to return all of the records that happened AFTER 5/18/2009. We definitely need to update the documentation to be more specific as to how to specify date ranges.
We're going to try to get a fix in place tonight to correct the bug on the historical data retrieval, so by tomorrow morning, it should hopefully work OK for you.
|
|
-
06-16-2009, 6:15 PM |
-
jposkey
-
-
-
Joined on 05-01-2009
-
-
Posts 12
-
-
|
Re: How to access history in PHP
I've been able to ignore the date issue for a while, but now it's really starting to bite.
I cannot get any queries with dates to work, even the one that is cited in the documentation:
dent=='N111FB' && dest=='MCO' && depttime>'5/19/2009 18:40'
Is the documentation just wrong on this?
Also, I know that on your website (http://fboweb.com/tracking/), I can narrow my search by airline, but I can't see how to do that in the API. Is that possible?
Jeral
|
|
-
06-16-2009, 6:21 PM |
-
agreen
-
-
-
Joined on 04-03-2008
-
-
Posts 51
-
-
|
Re: How to access history in PHP
Hey Jeral! In your example, it looks like the leading "i" is left out of the word "ident" - is that just a typo in your cut-and-paste? Otherwise, that would definitely cause a problem!
Additionally, it looks like we need to change our documentation, since N111FB hasn't flown into MCO in several months... so the example would not return any records.
Try searching for N111FB into ORL any time after 1/1/2009...!
|
|
-
06-16-2009, 7:15 PM |
-
jposkey
-
-
-
Joined on 05-01-2009
-
-
Posts 12
-
-
|
Re: How to access history in PHP
Thanks for the fast reply. Yes, that was just a cut & paste problem. Here's my full line of code, with your edit:
$history = $PlaneXML->FlightHistory("ident=='N111FB' && dest=='MCO' && depttime>'1/1/2009'",2);
Still no results, though.
Any thoughts on my question about whether we can search by airline name?
|
|
-
06-16-2009, 7:54 PM |
-
agreen
-
-
-
Joined on 04-03-2008
-
-
Posts 51
-
-
|
Re: How to access history in PHP
Hmm; it looks like you uncovered a bug in part of the query processing... we have a fix that's ready to be put in place for tonight's update, sometime after 10:30 PM Eastern time (before Midnight Eastern time), so if you can hang in there until then, hopefully you'll be good-to-go afterwards.
As for finding by airline, you should be able to do something like:
FlightHistory("left(ident,3)=='AAL' && depttime>'1/1/2009'",2)
The above query will return the 2 flights - it should work OK tonight after we get the bug-fix in place.
|
|
-
06-17-2009, 3:14 AM |
-
jposkey
-
-
-
Joined on 05-01-2009
-
-
Posts 12
-
-
|
Re: How to access history in PHP
Okay, this is interesting. We're getting closer!
Your query works (sort of):
FlightHistory("left(ident,3)=='AAL' && depttime>'1/1/2009'",2)
But let's start playing with the date. It seems to work all the way through 4/21/09, but randomly chosen dates from 4/22/09 to the present seem to fail.
Second, the original query only *seems* to work. I'm asking for a date > 1/1/2009, but the results are all for 6/16 and 6/17 (i.e., the most recent flights).
I tried using the 4/22/2009 now seems to work, although other dates like 5/18 are still failing.) However, using both a > and a dept=='SAN' && dest=='DFW' && left(ident,3)=='AAL' && depttime'5/16/2009'
Feel free to ask questions if you are noticing something different, but I'm not going to put more time on this now, hoping that it will be really obvious on your end.
|
|
-
06-17-2009, 11:03 AM |
-
agreen
-
-
-
Joined on 04-03-2008
-
-
Posts 51
-
-
|
Re: How to access history in PHP
Ok; part of the problem is that we chose to have the records returned in reverse order, most recent to oldest... but I think you've uncovered a deeper issue that we need to reconsider for the production version of the FlightHistory function.
|
|
|
|