Simple PHP object encapsulation of the National Rail Enquiries SOAP OpenLDBWS

1,166 views
Skip to first unread message

Rail Ale Fan

unread,
Dec 19, 2014, 11:38:10 AM12/19/14
to openrail...@googlegroups.com
Hi everyone,

Just wanted the share the very simple (no error checking or anything) PHP object encapsulation of the National Rail Enquiries SOAP live departure boards web service that I created for my personal project which I have posted at

https://github.com/railalefan/phpOpenLDBWS

Library source:

https://github.com/railalefan/phpOpenLDBWS/blob/master/OpenLDBWS.php

Usage couldn't be easier - create an object instance;

  $OpenLDBWS = new OpenLDBWS("YOUR_ACCESS_TOKEN");

...and use the methods exactly as documented at http://www.livedepartureboards.co.uk/ldbws/ for example, next 10 departures from London Paddington:

  $departureBoard = $OpenLDBWS->GetDepartureBoard(10,"PAD");

Return value is a PHP object representation of the response - dump using

  print_r($departureBoard);

I signed up to try out the web services as I didn't feel that any of the current smart phone oriented live departures apps / web sites really made the best use of the latest techniques in responsive HTML and background request ("AJAX") techniques - here's my implementation - live departures from your nearest station...

http://www.railalefan.co.uk/rail/departures/nearest/

Click a destination to background request and load service details for any departure.

Hope this helps!

russell pirie

unread,
Jan 30, 2015, 5:06:03 PM1/30/15
to openrail...@googlegroups.com
I have been using this for past few weeks and it has been working great. But today 1 in 3 requests fails crashing the php. Is any one else having problems with the soap Ali today?

Peter Hicks

unread,
Jan 31, 2015, 10:14:10 AM1/31/15
to russell pirie, openrail...@googlegroups.com
Hi Russell

On 30 Jan 2015, at 22:06, russell pirie <rus...@googlemail.com> wrote:

> I have been using this for past few weeks and it has been working great. But today 1 in 3 requests fails crashing the php. Is any one else having problems with the soap Ali today?


Do you get an error back from the API, e.g. a 500 Server Error?

Can you get your code to dump the request you send and the response you get back? It may be that your script is having trouble parsing the response in some circumstances.


Peter

signature.asc

russell pirie

unread,
Jan 31, 2015, 12:34:07 PM1/31/15
to openrail...@googlegroups.com
It crashes on line 31 in OpenLDBWS.php which is this
return $this->soapClient->$method($params);

So I haven't actually had a chance to parse any data at this point. It was running very smoothly for 2 weeks just yesterday and today its not working 100% its either not returning any data or not connecting or some thing. I will try and put some php debugging on the soap class.

Very intermittent which is what is strange.

Its ok at the moment. Quite hard to debug.

russell pirie

unread,
Jan 31, 2015, 12:45:00 PM1/31/15
to openrail...@googlegroups.com
Its all running ok at moment.

I have created a debug php and will keep and eye on it. When it starts to go wrong hopefully I can get more information from this.

russell pirie

unread,
Jan 31, 2015, 1:04:45 PM1/31/15
to openrail...@googlegroups.com
Crashing with

Fatal error: Uncaught SoapFault exception: [HTTP] in /var/www/html/lib/OpenLDBWS1.php:35 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://lite.re...', 'http://thalesgr...', 1, 0) #1 /var/www/html/lib/OpenLDBWS1.php(35): SoapClient->__call('GetDepartureBoa...', Array) #2 /var/www/html/lib/OpenLDBWS1.php(35): SoapClient->GetDepartureBoard(Array) #3 /var/www/html/lib/OpenLDBWS1.php(40): OpenLDBWS->StationBoard('GetDepartureBoa...', 3, 'PAD', '', '', '', '') #4 /var/www/html/debug.php(12): OpenLDBWS->GetDepartureBoard(3, 'PAD', '') #5 {main} thrown in/var/www/html/lib/OpenLDBWS1.php on line 35

line 31 is return $this->soapClient->$method($params);

russell pirie

unread,
Jan 31, 2015, 1:07:11 PM1/31/15
to openrail...@googlegroups.com
Still showing all the methods just does not like receiving the departure board data.

array(8) {
  [0]=>
  string(77) "StationBoardResponseType GetDepartureBoard(GetBoardRequestParams $parameters)"
  [1]=>
  string(75) "StationBoardResponseType GetArrivalBoard(GetBoardRequestParams $parameters)"
  [2]=>
  string(84) "StationBoardResponseType GetArrivalDepartureBoard(GetBoardRequestParams $parameters)"
  [3]=>
  string(88) "ServiceDetailsResponseType GetServiceDetails(GetServiceDetailsRequestParams $parameters)"
  [4]=>
  string(77) "StationBoardResponseType GetDepartureBoard(GetBoardRequestParams $parameters)"
  [5]=>
  string(75) "StationBoardResponseType GetArrivalBoard(GetBoardRequestParams $parameters)"
  [6]=>
  string(84) "StationBoardResponseType GetArrivalDepartureBoard(GetBoardRequestParams $parameters)"
  [7]=>
  string(88) "ServiceDetailsResponseType GetServiceDetails(GetServiceDetailsRequestParams $parameters)"
}
array(2) {
  ["numRows"]=>
  int(3)
  ["crs"]=>
  string(3) "PAD"
}
<br />
<b>Fatal error</b>:  Uncaught SoapFault exception: [HTTP]  in /var/www/html/lib/OpenLDBWS1.php:36
Stack trace:
#0 [internal function]: SoapClient-&gt;__doRequest('&lt;?xml version=&quot;...', 'https://lite.re...', 'http://thalesgr...', 1, 0)
#1 /var/www/html/lib/OpenLDBWS1.php(36): SoapClient-&gt;__call('GetDepartureBoa...', Array)
#2 /var/www/html/lib/OpenLDBWS1.php(36): SoapClient-&gt;GetDepartureBoard(Array)
#3 /var/www/html/lib/OpenLDBWS1.php(41): OpenLDBWS-&gt;StationBoard('GetDepartureBoa...', 3, 'PAD', '', '', '', '')
#4 /var/www/html/debug.php(12): OpenLDBWS-&gt;GetDepartureBoard(3, 'PAD', '')
#5 {main}
  thrown in <b>/var/www/html/lib/OpenLDBWS1.php</b> on line <b>36</b><br />

Peter Hicks

unread,
Jan 31, 2015, 1:37:05 PM1/31/15
to openrail...@googlegroups.com
Hi Russell


On 31/01/15 18:07, russell pirie wrote:
Still showing all the methods just does not like receiving the departure board data.
Could you post your code, *without* your API token included?  I don't grok PHP, but somebody else may be able to help with the problem.


Peter

russell pirie

unread,
Jan 31, 2015, 2:22:00 PM1/31/15
to openrail...@googlegroups.com
I am the same I am not  php developer hehe.
I have attached my debug files.


The OpenLDBWS is the same file I have been running for past 2 weeks. Something much must of changed network rail end.
debug.php
OpenLDBWS1.php

russell pirie

unread,
Feb 1, 2015, 7:57:36 AM2/1/15
to openrail...@googlegroups.com
I am so confused :(
Put the example files onto another server, same problem
Yet every time it starts to fail I go back and try rail ale fan example and its working fine.
 
But my examples (copy and past of rail ale fans) do not work (intermittently, working 80% of the time)

This is my original server whic was perfect until friday
This is another server I have
This is rail ale fan erver

Confused is an understatement!!!! 

Rail Ale Fan

unread,
Feb 1, 2015, 11:46:16 AM2/1/15
to openrail...@googlegroups.com
Hi Russell,

A couple of tests can be done to rule things out - any kind of issue with WSDL caching, and, if still no joy, whether or not it is something SSL related since the lite.realtime.nationalrail.co.uk server does not [currently] require SSL.

Firstly, I would suggest disabling WSDL caching.  Where you have this code at line 8 of OpenLDBWS.php:

$this->soapClient = new SoapClient("https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx",array('trace' => TRUE,'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP ));

...REPLACE with:

$this->soapClient = new SoapClient("https://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx",array('trace' => TRUE,'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,'cache_wsdl' => WSDL_CACHE_NONE ));

If that doesn't make any difference and you are still getting the exception; revert that change (since clients really should be caching WSDL files!), and replace https in the wsdl URL with just http:

$this->soapClient = new SoapClient("http://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx",array('trace' => TRUE,'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP ));

russell pirie

unread,
Feb 1, 2015, 12:23:04 PM2/1/15
to openrail...@googlegroups.com
Hi Rail Ale Fan

I have removed the caching like you suggested and will keep and eye on it.

Whats happening is the response object is coming back undefined which is strange and this is what crashes the php.

I have also noticed (I have 2 tokens) When it starts to play up switching to the other token seems to correct it self. Almost like the account is been blocked for a short period of time?


This is my main PHP script that intern uses yours. I support multiple destinations and also grab the calling at data. So will be making multiple calls to the api in quick succession is this maybe getting my account blocked? Is this not allowed?

Just seems every time mine goes down your one is still up and running so it cant be a problem with the service but maybe my account? (tried on 2 different servers now and both have problems so I don't think its a problem with way I have the servers setup)


I have uploaded my main PHP script which my js client calls. If you could take a look and see if I am doing some thing wrong? I am not a php developer and might be making some mistakes or not doing stuff as efficiently as I could.

Thank you :)
ldbwsService.php

Rail Ale Fan

unread,
Feb 2, 2015, 6:05:54 AM2/2/15
to openrail...@googlegroups.com
Hi Russell,
 
I've updated the library to optionally enable trace and if set to display the soap fault message and client request / response on error so if you're still experiencing problems grab the latest;


...and instantiate using

  $OpenLDBWS = new OpenLDBWS("YOUR_ACCESS_TOKEN",TRUE);

The debug output strips your access token from the request to avoid it becoming accidentally indexed!

Use a slightly modified version of example1.php with the Content-Type: text/plain header call at the top so that you'll be able to view the XML easily:

<?php
  header("Content-Type: text/plain");
  require("OpenLDBWS.php");
  $OpenLDBWS = new OpenLDBWS("YOUR_ACCESS_TOKEN",TRUE);
  $departureBoard = $OpenLDBWS->GetDepartureBoard(10,"PAD");
  print_r($departureBoard);
?>

This is my main PHP script that intern uses yours. I support multiple destinations and also grab the calling at data. So will be making multiple calls to the api in quick succession is this maybe getting my account blocked? Is this not allowed?

Not that i'm aware of - my Destinations / Next Train To.. board based on the next 10 departures does exactly the same thing and I've not seen any sign of throttling or temporary disabling at all...  

Hope this helps!

russell pirie

unread,
Feb 2, 2015, 8:09:36 AM2/2/15
to openrail...@googlegroups.com
hello

I have been running all night / this morning without the caching turned on and it's perfect again. Requests are longer but at least they work :)

Still not sure why all of a sudden I had to make this change?

Regards
Russell Pirie

russell pirie

unread,
Feb 3, 2015, 4:42:05 AM2/3/15
to openrail...@googlegroups.com
And its back to been screwed again!!!!

russell pirie

unread,
Feb 3, 2015, 4:47:55 AM2/3/15
to openrail...@googlegroups.com
Notice: Trying to get property of non-object in /var/www/html/ldbwsService.php on line 28

Warning: First parameter must either be an object or the name of an existing class in /var/www/html/ldbwsService.php on line 87

Notice: Trying to get property of non-object in /var/www/html/ldbwsService.php on line 28

Warning: First parameter must either be an object or the name of an existing class in /var/www/html/ldbwsService.php on line 87

Notice: Trying to get property of non-object in /var/www/html/ldbwsService.php on line 51

Notice: Trying to get property of non-object in /var/www/html/ldbwsService.php on line 52

Notice: Trying to get property of non-object in /var/www/html/ldbwsService.php on line 53

Warning: First parameter must either be an object or the name of an existing class in /var/www/html/ldbwsService.php on line 87

Warning: First parameter must either be an object or the name of an existing class in /var/www/html/ldbwsService.php on line 87
{"generatedAt":null,"locationName":null,"crs":null,"platformAvailable":"","nrccMessages":[],"trainServices":[]}

russell pirie

unread,
Feb 3, 2015, 4:52:36 AM2/3/15
to openrail...@googlegroups.com
They are definitely blocking my account, because I swapped tokens and it instantly fixes the problem!

What am i doing they don't like?

Rail Ale Fan

unread,
Feb 3, 2015, 5:08:30 AM2/3/15
to openrail...@googlegroups.com
Hi Russell,

Your debug output implies that some kind of response was received so no SOAP fault was triggered however you can still get at the request / response easily.

Make sure you're using the latest version of OpenLDBWS.php and instantiate with trace enabled;


    $OpenLDBWS = new OpenLDBWS("YOUR_ACCESS_TOKEN",TRUE);

Then edit OpenLDBWS.php and add the following functions to the class:

    function getLastRequest()
    {
      return $this->soapClient->__getLastRequest();
    }
    function getLastResponse()
    {
      return $this->soapClient->__getLastResponse();
    }

Then if you can catch the error condition, add the following to your debug output:

    print $OpenLDBWS->getLastRequest();
    print $OpenLDBWS->getLastResponse();

Don't forget to strip your access token from the request before posting..!

russell pirie

unread,
Feb 3, 2015, 5:19:05 AM2/3/15
to openrail...@googlegroups.com
Working again now! its so intermittent making this a nightmare to track down :(

I will give the trace a go.

Thanks

Peter Hicks

unread,
Feb 3, 2015, 6:38:32 AM2/3/15
to russell pirie, openrail...@googlegroups.com
Hi Russell

> On 3 Feb 2015, at 10:19, russell pirie <rus...@googlemail.com> wrote:
>
> Working again now! its so intermittent making this a nightmare to track down :(
>
> I will give the trace a go.

Tracing what happens is the only way you can conclusively say what’s going on.

“I sent this SOAP request and I received this reply”, including HTTP status code, will make it clear where the problem is.


Peter


signature.asc

russell pirie

unread,
Feb 4, 2015, 1:24:59 PM2/4/15
to openrail...@googlegroups.com, rus...@googlemail.com
I have been keeping a close eye on it and it has been running smoothly hehe. I have that debug php at the ready in case it starts to play up again! :)

Thanks for all your help :)

This is my little departure board if any one is interested :)

russell pirie

unread,
Feb 23, 2015, 11:06:26 AM2/23/15
to openrail...@googlegroups.com, rus...@googlemail.com
Both my accounts have been disabled again :(

Rail Ale Fan

unread,
Feb 23, 2015, 1:49:47 PM2/23/15
to openrail...@googlegroups.com, rus...@googlemail.com
Hi Russell,

Have you been able to capture the trace output when making a request with your access tokens disabled?  You can add the request / response headers to the output by adding

  $traceOutput["soapClientRequestHeaders"] = $this->soapClient->__getLastResponseHeaders();
  $traceOutput
["soapClientResponseHeaders"] = $this->soapClient->__getLastResponseHeaders();



...just before this line in OpenLDBWS.php:

  print_r($traceOutput);

Don't forget to instantiate the object with trace enabled;

 $OpenLDBWS = new OpenLDBWS("YOUR_ACCESS_TOKEN",TRUE);


That will reveal whether it is a straight forward "HTTP/1.1 401 Unauthorized" is being returned, or something more specific...

Cheers

russell pirie

unread,
Feb 26, 2015, 4:51:11 AM2/26/15
to openrail...@googlegroups.com, rus...@googlemail.com
Keeps cutting out definitely an account thing not service, as I have 2 accounts and one will be working the other one wont be. Getting quite tired of this now :( Might swap over to the real time trains api!!!!!



Here is the error report

Array
(
    [soapFaultMessage] => 
    [soapClientRequest] => <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://thalesgroup.com/RTTI/2014-02-20/ldb/" xmlns:ns2="http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes"><SOAP-ENV:Header><ns2:AccessToken><ns2:TokenValue></ns2:TokenValue></ns2:AccessToken></SOAP-ENV:Header><SOAP-ENV:Body><ns1:GetDepartureBoardRequest><ns1:numRows>1</ns1:numRows><ns1:crs>PAD</ns1:crs></ns1:GetDepartureBoardRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>

    [soapClientResponse] => 
    [soapClientRequestHeaders] => HTTP/1.1 429 
Cache-Control: private
Content-Length: 57
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-server: liteweb201
Date: Thu, 26 Feb 2015 09:48:16 GMT

    [soapClientResponseHeaders] => HTTP/1.1 429 
Cache-Control: private
Content-Length: 57
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-server: liteweb201
Date: Thu, 26 Feb 2015 09:48:16 GMT

)
result:






lastRequest:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://thalesgroup.com/RTTI/2014-02-20/ldb/" xmlns:ns2="http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes"><SOAP-ENV:Header><ns2:AccessToken><ns2:TokenValue>REMOVED BY ME</ns2:TokenValue></ns2:AccessToken></SOAP-ENV:Header><SOAP-ENV:Body><ns1:GetDepartureBoardRequest><ns1:numRows>1</ns1:numRows><ns1:crs>PAD</ns1:crs></ns1:GetDepartureBoardRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>


lastResponse:

Kevin Fullerton

unread,
Feb 26, 2015, 4:54:08 AM2/26/15
to openrail...@googlegroups.com
I don't use this API, but the error code it's returning (429) relates to too many requests, so it sounds like it's rate-limiting you ... how many requests per second/minute are you making?  Might be worth dialling down the number of requests you make (and you'll probably need to wait for the rate-limit to "expire" before you can make any more requests)

Cheers

Kevin

--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To post to this group, send email to openrail...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

russell pirie

unread,
Feb 26, 2015, 5:48:44 AM2/26/15
to openrail...@googlegroups.com
Ah ok some useful information :)

The app it selfs makes a request every 30 seconds but each request can actually be 2 requests as it also asks for the service information as well.
And the retry code was a big aggressive. 

I have cut it down to every 60 seconds and cut down the retry code to every 5 min.

Hopefully this lightens the load and falls within there request limit.

Regards
Russell Pirie

russell pirie

unread,
Mar 3, 2015, 4:54:15 AM3/3/15
to openrail...@googlegroups.com
Was ok for a while now back to 429 http errors. The app runs 2 requests every min, I have about 8 apps running. I am well under my 5000 requests per hour. Getting quite bored of this now :(

Peter Hicks

unread,
Mar 3, 2015, 5:09:17 AM3/3/15
to russell pirie, openrail...@googlegroups.com

On 3 Mar 2015, at 09:54, russell pirie <rus...@googlemail.com> wrote:

> Was ok for a while now back to 429 http errors. The app runs 2 requests every min, I have about 8 apps running. I am well under my 5000 requests per hour. Getting quite bored of this now :(

Are you 100% sure you’re only requesting data 16 times per minute? Using tcpdump/Wireshark to verify this would be a logical next step, as it might be that your client is making more than two requests per minute.

Also, is your code Open Source? If so, somebody else on the list may be able to try it with their token to see if they get the same error.


Peter

signature.asc

russell pirie

unread,
Mar 3, 2015, 5:50:03 AM3/3/15
to openrail...@googlegroups.com, rus...@googlemail.com
That is a good idea, Noticed another version was running older code making quite frequent requests on retrys (on error)

Have cleared cached. Hopefully this sorts it (I'm sure it was still withing 5000 requests an hour though)

Regards
Russell Pirie 

Rail Ale Fan

unread,
Oct 20, 2019, 6:05:48 AM10/20/19
to A gathering place for the Open Rail Data community
Hi all,

OpenLDBSVWS (Staff Version) PHP SOAP client example/wrappers for main and reference services now uploaded;

. https://github.com/railalefan/phpOpenLDBSVWS .

Cheers

Emma

unread,
Dec 27, 2019, 1:53:36 PM12/27/19
to A gathering place for the Open Rail Data community
Hello,

I'm trying to get the result to print as a table, not used to objects in php. Any pointer please? (:

Rail Ale Fan

unread,
Dec 28, 2019, 10:10:16 AM12/28/19
to A gathering place for the Open Rail Data community
Hi Emma,

I've uploaded an HTML table example (example3.php) to the phpOpenLDBWS (rather than phpOpenLDBSVWS) repo;

. https://github.com/railalefan/phpOpenLDBWS .

Cheers

Emma

unread,
Jan 5, 2020, 10:09:23 AM1/5/20
to A gathering place for the Open Rail Data community
Hello,

Thanks for that, very helpful to build a basis for my code.

I'm trying to print the NRCC messages and i can only get a print_r to work but it shows the obj/array info.

$mess = $response->GetStationBoardResult->nrccMessages];

with print $mess; just returning nothing but errors.

print_r($mess); 

just returns the array.

Any ideas please?

Michael Berry

unread,
Jan 5, 2020, 10:50:33 AM1/5/20
to A gathering place for the Open Rail Data community
Hi Emma,

You probably want a foreach loop or similar to loop through each item in the array, then print out the corresponding values you're after. My understanding is that print_r() is really just meant as a debug tool for printing human readable information about a given variable (PHP is far from my primary language though, so take that with a pinch of salt if others disagree.)

If you upload your code to a gist or repository on Github or similar so we can take a look and suggest changes, that might be helpful too.

Thanks,

Michael

--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.


--
Thanks,

Michael

Emma

unread,
Jan 5, 2020, 10:53:12 AM1/5/20
to A gathering place for the Open Rail Data community
Finally fixed it with <?php

print_r($mess->message->_);?>

Now to work out how to put calling points in.... 
To unsubscribe from this group and stop receiving emails from it, send an email to openrail...@googlegroups.com.


--
Thanks,

Michael

Rail Ale Fan

unread,
Jan 5, 2020, 11:25:16 AM1/5/20
to A gathering place for the Open Rail Data community
Hi Emma,

For some additional info and pointers the following snippet using $response will print each NRCC message as a paragraph;

if (isset($response->GetStationBoardResult->nrccMessages))
{
  if (is_array($response->GetStationBoardResult->nrccMessages->message))
  {
    $messages = $response->GetStationBoardResult->nrccMessages->message;
  }
  else
  {
    $messages = array($response->GetStationBoardResult->nrccMessages->message);
  }

  foreach($messages as $message)
  {
    print "<p>".$message->{"_"}."</p>";
  }
}

As it stands you'll need to use the same coding pattern as above for calling points using a detailed response;

1) check if the object property you want to use exists using isset() (terminating services won't have any subsequentCallingPoints)

2) if so check if the property is an array or not, and normalise into an array in either case

3) loop over the array with foreach()

Cheers

Emma

unread,
Jan 5, 2020, 11:28:04 AM1/5/20
to A gathering place for the Open Rail Data community
I've tried

  $row = str_replace("{subsequentCallingPoints}",$ServiceItemWithCallingPoints->subsequentCallingPoints,$row);

within the table code with the relevant bits but this doesn't call the calling points for the service :(

Rail Ale Fan

unread,
Jan 6, 2020, 8:43:03 AM1/6/20
to A gathering place for the Open Rail Data community
Hi,

For completeness I've posted an extended version of Example 3 using the GetDepBoardWithDetails method as handling subsequentCallingPoints requires consideration of services that split (so again, as per the pattern posted above, callingPointList may or may not be an array...)

. https://railalefan.co.uk/phpOpenLDBWS/example3a.php .

The example is intended to cover handling the stdClass object created by PHP's SoapClient rather than how to go about generating an HTML departure board - for example rather than using string concatenation have a look at PHP's implode() function which makes for a convenient way to avoid superfluous HTML in your display output.

Anyway back on-topic for this board, Gatwick Airport is a great test location when developing against the open rail data feeds;

- 24 hour service if you happen to be coding on pizza and caffeine and looking for running trains
- regular splits (multiple destinations) and joins (multiple origins) to be handled
- regular through, terminating and originating services

Cheers

Emma

unread,
Jan 21, 2020, 2:47:08 PM1/21/20
to A gathering place for the Open Rail Data community
Quick question, when a calling point is caped or if a service is late, is this something easily reachable to update in the subsequentCallingPoints??

Matthew B

unread,
Jan 25, 2020, 7:12:49 AM1/25/20
to A gathering place for the Open Rail Data community
Seems the registration for openldbsvws has been down for a good 2 weeks now.
I've had access to the passenger version for some time now but registration for the staff version upon clicking the link for activation fails with "internal server error". The RDG staff panel are looking into it.
Nice work with the php encapsulation, it works well.

Terence Eden

unread,
Feb 8, 2020, 10:11:30 AM2/8/20
to A gathering place for the Open Rail Data community
I'm having a little trouble with - https://github.com/railalefan/phpOpenLDBWS
It's an excellent bit of code, but I can't seem to set a filterType on GetDepBoardWithDetails

`$response = $OpenLDBWS->GetDepBoardWithDetails(5, "ABW", "LBG", "to");`

That *should* set a `$filterType` of `to` and only give me trains going to London Bridge. But it seems to return trains coming both to and from.

According to https://lite.realtime.nationalrail.co.uk/OpenLDBWS/, filterType is a string, either "from" or "to".

Any idea what I'm doing wrong?

On Friday, 19 December 2014 16:38:10 UTC, RailAleFan wrote:
Hi everyone,

Just wanted the share the very simple (no error checking or anything) PHP object encapsulation of the National Rail Enquiries SOAP live departure boards web service that I created for my personal project which I have posted at

https://github.com/railalefan/phpOpenLDBWS



Peter Hicks

unread,
Feb 8, 2020, 10:14:12 AM2/8/20
to A gathering place for the Open Rail Data community
Abbey Wood has circular services which start and terminate at Cannon Street, e.g. https://www.opentraintimes.com/schedule/W45092/2020-02-08

You may be getting trains from London Bridge to Abbey Wood via the short or long bit of the loop, at a guess.


Peter

--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openraildata-talk/4bd42dc2-2238-4d76-a67a-96290bb47930%40googlegroups.com.


OpenTrainTimes Ltd. registered in England and Wales, company no. 09504022.
Registered office: 13a Davenant Road, Upper Holloway, London N19 3NW

Terence Eden

unread,
Feb 8, 2020, 11:21:05 AM2/8/20
to A gathering place for the Open Rail Data community
Ah! That makes sense. Thank you. I'll filter by platform instead.

On Saturday, 8 February 2020 15:14:12 UTC, Peter Hicks wrote:
Abbey Wood has circular services which start and terminate at Cannon Street, e.g. https://www.opentraintimes.com/schedule/W45092/2020-02-08

You may be getting trains from London Bridge to Abbey Wood via the short or long bit of the loop, at a guess.


Peter

On Sat, 8 Feb 2020, 15:11 Terence Eden, <teren...@gmail.com> wrote:
I'm having a little trouble with - https://github.com/railalefan/phpOpenLDBWS
It's an excellent bit of code, but I can't seem to set a filterType on GetDepBoardWithDetails

`$response = $OpenLDBWS->GetDepBoardWithDetails(5, "ABW", "LBG", "to");`

That *should* set a `$filterType` of `to` and only give me trains going to London Bridge. But it seems to return trains coming both to and from.

According to https://lite.realtime.nationalrail.co.uk/OpenLDBWS/, filterType is a string, either "from" or "to".

Any idea what I'm doing wrong?

On Friday, 19 December 2014 16:38:10 UTC, RailAleFan wrote:
Hi everyone,

Just wanted the share the very simple (no error checking or anything) PHP object encapsulation of the National Rail Enquiries SOAP live departure boards web service that I created for my personal project which I have posted at

https://github.com/railalefan/phpOpenLDBWS



--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrail...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages