×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

php - using API to UK live rail departure boards

php - using API to UK live rail departure boards

php - using API to UK live rail departure boards

(OP)
Hello - I wonder if someone can give a bit of adice. I came across the API to the UK live train departure boards recently - although I understand it has been around for a while. The interface is described here:

http://www.livedepartureboards.co.uk/ldbws/

As my first attempt at retreiving some info using it, I used the following bit of php:

CODE

<?
require_once 'SOAP/Client.php';

$wsdl_url = 'http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx';
$wsdl = new SOAP_WSDL($wsdl_url);
$proxy=$wsdl->getProxy();

$response =  $proxy->GetDepartureBoard(10,'KGX');

print_r($response);
?>

I have tried various permutations on the above, but continuously get the error "No crs code required" (where crs code is the three digit station code)

Any ideas?

Cheers,

Ben
 

RE: php - using API to UK live rail departure boards

That's not the PHP5 SOAP interface is it ?, might be worth using that (assuming your on 5) and see what comes out.
 

RE: php - using API to UK live rail departure boards

(OP)
No - I was using the PEAR soap library for php since it works in older versions of php. As it turns out I am running php 5, so I tried it using the native soap client support, but unfortunately got exactly the same error returned sad

CODE

<?php
$client = new SoapClient("http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx");

try{
        $data=$client->GetDepartureBoard(10,"KGX");
}
catch (SoapFault $exception){
        echo 'EXCEPTION='.$exception;
}
print_r($data);
?>
 

RE: php - using API to UK live rail departure boards

(OP)
Ah...

Well, the my initial attempt using PEAR didn't work, and neither did my first attempt at using native php support.

But passing the parameters in using an array worked fine:

[/code]
<?php
$client = new SoapClient("http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx");

$arr = array("crs" => "KGX", "numRows" => 10);

$data=$client->GetDepartureBoard($arr);

print_r($data);
?>
[/code]

Hpowever, using the same fix with thr PEAR library still gave the original error. At least it is working in php 5 now though smile

RE: php - using API to UK live rail departure boards

i think that there may have been an issue with the server.  when the question was first posted I was unable to access the server to retrieve the SOAP methods exposed by the API.   

RE: php - using API to UK live rail departure boards

Glad you got it to work, SOAP is supposed to be easy - it never is !

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close